【解决方案】java.lang.IllegalStateException Unable to find a @SpringBootConfiguration错误

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

问题截图:

在这里插入图片描述

出现原因:

在进行单元测试时我太懒了,随便建了个test包就进行测试,导致出现这个问题
解决方案:
将包名改为与其他分支一样的路径。就可以了!
如下图:

在这里插入图片描述

发布了147 篇原创文章 · 获赞 88 · 访问量 14万+

猜你喜欢

转载自blog.csdn.net/zpwangshisuifeng/article/details/104408740