关于WebSocket连接报404的问题
我的项目解决办法是:我是用springboot内置的Tomcat启动的(这种方式出现的问题多),所以在代码里少了这个配置文件
@Configuration
public class WebSocketConfig {
/**
* ServerEndpointExporter 作用
*
* 这个Bean会自动注册使用@ServerEndpoint注解声明的websocket endpoint
*
* @return
*/
@Bean
public ServerEndpointExporter serverEndpointExporter() {
return new ServerEndpointExporter();
}
}
然后我再次启动就好了。