Unable to find a @SpringBootConfiguration, you need to use @ContextConfiguration or @SpringBootTest(classes=...) with your test\
时间: 2023-11-08 20:14:47 浏览: 158
"Unable to find a @SpringBootConfiguration, you need to use @ContextConfiguration or @SpringBootTest(classes=...) with your test"这个错误信息通常是由于在测试类中未正确配置Spring Boot的相关注解导致的。在进行Spring Boot测试时,需要使用@ContextConfiguration或者@SpringBootTest(classes=...)来指定测试类的配置信息。这些注解可以确保测试类能够正确加载Spring Boot的配置文件和依赖项。如果没有正确配置这些注解,就会导致无法找到@SpringBootConfiguration的错误。因此,为了解决这个错误,请确保在测试类上正确配置@ContextConfiguration或@SpringBootTest(classes=...)注解,以指定测试类的配置信息。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *2* *3* [Unable to find a @SpringBootConfiguration, you need to use @ContextConfiguration or @SpringBootTest.](https://blog.csdn.net/shaoming314/article/details/119739434)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 100%"]
[ .reference_list ]
阅读全文