问题描述: java.lang.IllegalStateException: Unable to find a @SpringBootConfiguration, you need to use @ContextConfiguration or @SpringBootTest(classes=…) with your test 问题截图: 出现原因: 在进行单元测试时我太懒了,随便建了个test包就进行测试,导致出现这个问题 解决方案: 将包名改为与其他分支一样的路径。就可以了! 如下图: 然后再执行就可以啦,亲测有效!!