错误再现 在SpringBoot项目手写测试类时报错:java.lang.IllegalStateException: Unable to find a @SpringBootConfiguration, you need to use @ContextConfiguration or @SpringBootTest(classes=...) with your test,如下所示: 解决
错误再现
在SpringBoot项目手写测试类时报错:java.lang.IllegalStateException: Unable to find a @SpringBootConfiguration, you need to use @ContextConfiguration or @SpringBootTest(classes=...) with your test,如下所示:
解决方案
-
1、编写启动类
-
2、启动类和测试类所在的包名要相同