springboot单元测试出现 java.lang.IllegalStateException: Unable to find a @SpringBootConfiguration, you need to use @ContextConfiguration or @SpringBootTest(classes=...) with your test 通过百度解决,就是说将测试类的包名改成和普通类 的包名一样。就ok了 相关文章: