java.lang.IllegalStateException: Unable to find a @SpringBootConfiguration, you need to use @Context
发布时间:2022-10-30 01:08:20 375
相关标签: # java# java
错误再现
在SpringBoot项目手写测试类时报错:java.lang.IllegalStateException: Unable to find a @SpringBootConfiguration, you need to use @ContextConfiguration or @SpringBootTest(classes=...) with your test,如下所示:
解决方案
-
1、编写启动类
-
2、启动类和测试类所在的包名要相同
文章来源: https://blog.51cto.com/lianghecai/5794080
特别声明:以上内容(图片及文字)均为互联网收集或者用户上传发布,本站仅提供信息存储服务!如有侵权或有涉及法律问题请联系我们。
举报