springboot集成websocket启动异常信息
java.lang.IllegalStateException: Failed to register @ServerEndpoint class:
springboot集成websocket引用依赖
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-websocket</artifactId>
<version>2.1.2.RELEASE</version>
</dependency>
原websocket服务类
@ServerEndpoint("socket/echo/{sid}")
@Component
public class WebSocketServer {…}
@ServerEndpoint 注解中配置路径必须以"/" 开头
@ServerEndpoint("/socket/echo/{sid}")
注:
使用tomcat
初始化构建websocket时,org.apache.tomact.websocket.service.UriTemplate
对path进行检验,必须以"/"开头。
原文:记:websocket 启动异常 (Failed to register @ServerEndpoint)_立羽2022的博客-CSDN博客
作者:weixin_41099217