junit测试提示空指针
解决方案:
应该是注解没有加上的问题,普通的测试类是无法获取bean的,所以才会报空指针。需要让这个测试类运行在spring测试环境中,添加以下注解
@RunWith(SpringJUnit4ClassRunner.class)
Unable to find a @SpringBootConfiguration
解决方法:
spring cloud 项目编写单元测试需要指定 启动类。
@SpringBootTest(classes = CrmServerApplication.class)
There are test failures.
maven打包过滤测试代码
idea设置