赞
踩
项目问题:
博主在项目中引入了websocket功能主要作用于消息的推送,但是在进行其它方法Junit测试的时候发现出现如下错误
- org.springframework.beans.factory.BeanCreationException:
- Error creating bean with name 'serverEndpointExporter' defined in class path resource
解决方案:
- import org.junit.Test;
- import org.junit.runner.RunWith;
- import org.springframework.boot.test.context.SpringBootTest;
- import org.springframework.test.context.junit4.SpringRunner;
-
- @RunWith(SpringRunner.class)
- @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
- public class ApplicationTests {
-
- @Test
- public void contextLoads() {
- }
-
- }
可以参考官方文档 https://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-testing.html 里面有详细说明
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。