经验分享

【已解决】项目中使用websocket的时候,使用Junit自测其他diam提示:webSocket初始化失败怎么办?

【已解决】项目中使用websocket的时候,使用Junit自测其他diam提示:webSocket初始化失败错误信息如下图:解决方案:

【已解决】项目中使用websocket的时候,使用Junit自测其他diam提示:webSocket初始化失败

错误信息如下图:5efca9da4de2552fc00b4072b5aa1243.png

现场复现:

我使用spring boot 和 junit测试。测试类如下:

@RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest(classes = {BaseBuildApplication.class})
public class ScoreProjectDictServerImplTest  {

    @Resource
    private IScoreProjectDictServer scoreProjectDictServer;


    @Test
    public void selectAllTest(){
        System.out.println("1:"+scoreProjectDictServer.getById(1));
    }
}

错误信息: Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'serverEndpointExporter' defined in class path resource [com/hdtd/safequality/business/login/config/WebSocketConfig.class]: Invocation of init method failed; nested exception is java

原创不易,完成人机校验,阅读全文

相关推荐