关于SpringBootTest报错java.lang.IllegalStateException: Unable to find a @SpringBootConfiguration的问题解决

关于SpringBootTest报错java.lang.IllegalStateException: Unable to find a @SpringBootConfiguration的问题解决,第1张

1、问题
使用spring-boot执行测试时报错:

java.lang.IllegalStateException: Unable to find a
@SpringBootConfiguration, you need to use @ContextConfiguration or
@SpringBootTest(classes=…) with your test
**>

2、解决方案**
将测试类的包名修改与启动类的包名相同
例如:
测试类

springboot启动类

2.1 检查是否缺少启动类

欢迎分享,转载请注明来源:内存溢出

原文地址:https://www.54852.com/langs/919317.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-05-16
下一篇2022-05-16

发表评论

登录后才能评论

评论列表(0条)

    保存