springboot测试时出现:java.lang.IllegalStateException: Unable to find a @SpringBootConfiguration, you need to use @ContextConfiguration or @SpringBootTest(classes=...) with your test

翻译为:

java.lang.illegalStateException:找不到@springbootconfiguration,您的测试需要使用@contextconfiguration或@springbootstest(classes=..)。


解决java.lang.IllegalStateException: Unable to find a @SpringBootConfiguration, you need to use

 

找半天才发现是我项目主入口启动类没有,而是我大意的放在了一个包里,所以没有找到才会提示上面的错误,这个错误大部分就是找不到启动类,把启动类放根目录下就可以了!

解决java.lang.IllegalStateException: Unable to find a @SpringBootConfiguration, you need to use 解决java.lang.IllegalStateException: Unable to find a @SpringBootConfiguration, you need to use

相关文章: