meta파일이 꼬였을때 팁.
sts 끈후 .meta파일 날린후 import로 springsrc 를 한다.
WebSocket 을 사용하여 만든다.
WebSocket 참고예제 를 보고 만들어보기.
-> 수업시간엔 선생님이 문제생겨서 못진행했다.
<!--웹 소켓 사용 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-websocket</artifactId>
</dependency>
<!-- json simple json파싱을 위해
json-simple 라이브러리를 추가 -->
<dependency>
<groupId>com.googlecode.json-simple</groupId>
<artifactId>json-simple</artifactId>
<version>1.1.1</version>
</dependency>
1) 지정 Package
// 환경설정 annotation
@Configuration
@EnableWebSocket
public class WebSocketConfig implements WebSocketConfigurer {
@Autowired
SocketHandler socketHandler; // SocketHandler DI
@Override
public void registerWebSocketHandlers
(WebSocketHandlerRegistry registry) {
registry.addHandler(socketHandler, "/chating");
}
}
@SuppressWarning
컴파일 단위의 서브세트와 관련된 컴파일 경고를 사용하지 않도록 설정하는 것.
따라서 어떤 경고를 제외시킬지 옵션
1. all : 모든 경고를 억제
2. cast : 캐스트 연산자 관련 경고 억제
3. dep-ann : 사용하지 말아야 할 주석 관련 경고 억제
4. deprecation : 사용하지 말아야 할 메소드 관련 경고 억제
5. fallthrough : switch문에서의 break 누락 관련 경고 억제
6. finally : 반환하지 않는 finally 블럭 관련 경고 억제
7. null : null 분석 관련 경고 억제
8. rawtypes : 제네릭을 사용하는 클래스 매개 변수가 불특정일 때의 경고 억제
9. unchecked : 검증되지 않은 연산자 관련 경고 억제
10. unused : 사용하지 않는 코드 관련 경고 억제
참고자료
alert("사용자 이름을 입력해주세요.");
핸들러가 서버