请教各位大佬:
springboot2.0使用WebSocket 添加@Component启动报错
使用springboot内置tomcat (Apache Tomcat/9.0.13)
下面是报错信息:
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2019-01-23 16:35:16.201 ERROR 6888 --- [ main] o.s.boot.SpringApplication : Application run failed
java.lang.IllegalStateException: Failed to register @ServerEndpoint class: class lmy.com.magic.controller.WebSockTest$$EnhancerBySpringCGLIB$$21e933ed
at org.springframework.web.socket.server.standard.ServerEndpointExporter.registerEndpoint(ServerEndpointExporter.java:158) ~[spring-websocket-5.1.3.RELEASE.jar:5.1.3.RELEASE]
at org.springframework.web.socket.server.standard.ServerEndpointExporter.registerEndpoints(ServerEndpointExporter.java:133) ~[spring-websocket-5.1.3.RELEASE.jar:5.1.3.RELEASE]
at org.springframework.web.socket.server.standard.ServerEndpointExporter.afterSingletonsInstantiated(ServerEndpointExporter.java:111) ~[spring-websocket-5.1.3.RELEASE.jar:5.1.3.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:863) ~[spring-beans-5.1.3.RELEASE.jar:5.1.3.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:863) ~[spring-context-5.1.3.RELEASE.jar:5.1.3.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:546) ~[spring-context-5.1.3.RELEASE.jar:5.1.3.RELEASE]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:142) ~[spring-boot-2.1.1.RELEASE.jar:2.1.1.RELEASE]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:775) [spring-boot-2.1.1.RELEASE.jar:2.1.1.RELEASE]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) [spring-boot-2.1.1.RELEASE.jar:2.1.1.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:316) [spring-boot-2.1.1.RELEASE.jar:2.1.1.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1260) [spring-boot-2.1.1.RELEASE.jar:2.1.1.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1248) [spring-boot-2.1.1.RELEASE.jar:2.1.1.RELEASE]
at lmy.com.magic.DemoApplication.main(DemoApplication.java:12) [classes/:na]
Caused by: javax.websocket.DeploymentException: Cannot deploy POJO class [lmy.com.magic.controller.WebSockTest$$EnhancerBySpringCGLIB$$21e933ed] as it is not annotated with @ServerEndpoint
at org.apache.tomcat.websocket.server.WsServerContainer.addEndpoint(WsServerContainer.java:202) ~[tomcat-embed-websocket-9.0.13.jar:9.0.13]
at org.springframework.web.socket.server.standard.ServerEndpointExporter.registerEndpoint(ServerEndpointExporter.java:155) ~[spring-websocket-5.1.3.RELEASE.jar:5.1.3.RELEASE]
... 12 common frames omitted