@@ -0,0 +1,1246 @@
+package com.lance.websocket.config;%0A%0Aimport org.apache.logging.log4j.LogManager;%0Aimport org.apache.logging.log4j.Logger;%0Aimport org.springframework.web.socket.CloseStatus;%0Aimport org.springframework.web.socket.TextMessage;%0Aimport org.springframework.web.socket.WebSocketSession;%0Aimport org.springframework.web.socket.handler.TextWebSocketHandler;%0A%0Aimport com.lance.websocket.service.EchoService;%0A%0Apublic class EchoWebSocketHandler extends TextWebSocketHandler %7B%0A%09private static Logger logger = LogManager.getLogger(EchoWebSocketHandler.class);%0A%09private final EchoService echoService;%0A%0A%09public EchoWebSocketHandler(EchoService echoService) %7B%0A%09%09this.echoService = echoService;%0A%09%7D%0A%0A%09@Override%0A%09public void afterConnectionEstablished(WebSocketSession session) %7B%0A%09%09logger.debug(%22Opened new session in instance %22 + this);%0A%09%7D%0A%0A%09@Override%0A%09public void handleTextMessage(WebSocketSession session, TextMessage message) throws Exception %7B%0A%09%09String echoMessage = this.echoService.getMessage(message.getPayload());%0A%09%09logger.debug(echoMessage);%0A%09%09session.sendMessage(new TextMessage(echoMessage));%0A%09%7D%0A%0A%09@Override%0A%09public void handleTransportError(WebSocketSession session, Throwable exception) throws Exception %7B%0A%09%09session.close(CloseStatus.SERVER_ERROR);%0A%09%7D%0A%7D

add websocketHandler