背景
启动springboot项目测试类时报错:
Error creating bean with name 'serverEndpointExporter' defined in class path resource
[group/oneonetwo/hotelintelligencesystem/components/websocket/config/WebSocketConfig.class]: Invocation of init method
参考了博文,亲测第二种有效,在测试类里添加注解:
@SpringBootTest(webEnvironment=SpringBootTest.WebEnvironment.RANDOM_PORT)