@SpringbootTest报错 javax.websocket.server.ServerContainer not availableJ情况解决
在使用springboot单元测试出现:
11:11:10.799 [main] ERROR o.s.b.SpringApplication - [reportFailure,870] - Application run failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'serverEndpointExporter' defined in class path resource [com/health/framework/websocket/WebSocketConfig.class]: Invocation of init method failed; nested exception is java.lang.IllegalStateException: javax.websocket.server.ServerContainer not available at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1804) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:620)
原因:spring boot内带tomcat,tomcat中的websocket会有冲突出现问题
解决方法
使用