错误: Unable to find a @SpringBootConfiguration, you need to use @ContextConfiguration or @SpringBootTest(classes=…) with your test
原因:
在springBoot项目的 根路径下 缺少主配置类Application.class造成的
解决方案:在测试类上加注解
@RunnerWith(SpringRunner.class)
@SpringBootTest(主配置类.class)
例如:我将启动类放到了start包下面:
在测试类上加以下注解问题就解决了
@RunWith(SpringRunner.class)
@SpringBootTest(classes = FeifaApplication.class)
// 如果在根路径下没有application类则需要指定一个application类
如果你的问题还是没有解决,请参考:
https://blog.csdn.net/csdn_am/article/details/79757097