在SpringBoot项目中,用到了WebSocket,打包时出现了如下报错:
Error creating bean with name 'serverEndpointExporter' defined in class path resource [com/tht/printhub/config/WebSocketServerConfig.class]: jakarta.websocket.server.ServerContainer not available
在网上搜索几篇文章后,找到一个解决方案,将@Bean注解注释掉,即可成功打包。
@Configuration
public class WebSocketServerConfig {
// @Bean
public ServerEndpointExporter serverEndpointExporter (){
return new ServerEndpointExporter();
}
}