启动tomcat容器,部署SpringBoot项目,启动项目报错,如下图: 看1.2的顺序就知道是WebSocket冲突了. 上网找了一下资料发现,使用@ServerEndpoint创立websocket endpoint的时候,首先要注入ServerEndpointExporter,这个bean会自动注册使用了@ServerEndpoint注解声明的Websocket endpoint.如果使用独立的servlet容器,而不是直接使用springboot的内置容器,就不要注入ServerEnd