在使用SpringBoot写测试类时遇到报错
java.lang.IllegalStateException: Unable to find a @SpringBootConfiguration, you need to use @ContextConfiguration or @SpringBootTest(classes=…) with your test
一个可能是你没有写主启动类,二个是你测试类所在的包名和SpringBoot启动类所在的包名不一致导致
可以指定主启动类解决
或者包名和主启动类包名一致
java.lang.IllegalStateException: Unable to find a @SpringBootConfiguration, you need to use @Context
最新推荐文章于 2024-06-16 20:55:46 发布