错误再现
在SpringBoot项目手写测试类时报错:java.lang.IllegalStateException: Unable to find a @SpringBootConfiguration, you need to use @ContextConfiguration or @SpringBootTest(classes=...) with your test,如下所示:
解决方案
-
1、编写启动类
-
2、启动类和测试类所在的包名要相同
在SpringBoot项目手写测试类时报错:java.lang.IllegalStateException: Unable to find a @SpringBootConfiguration, you need to use @ContextConfiguration or @SpringBootTest(classes=...) with your test,如下所示:
1、编写启动类
2、启动类和测试类所在的包名要相同
简单的小日志:单元测试发现如下错误: java.lang.IllegalStateException: Unable to find a @SpringBootConfiguration, you need to use @ContextConfiguration or @SpringBootTest(classes=...) with your test at org.spr...
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.healthmanager/com.example.healthmanager.LoginActivity}: java.lang.IllegalStateException: You need to use a Theme.AppCompa
举报文章
请选择举报类型
补充说明
0/200
上传截图
格式支持JPEG/PNG/JPG,图片不超过1.9M