Unable to find a @SpringBootConfiguration, you need to use @ContextConfiguration
时间: 2023-08-28 11:20:53 浏览: 222
和@SpringBootTest(classes=...)中的测试。 这个异常的意思是在你的测试中找不到@SpringBootConfiguration注解,需要使用@ContextConfiguration 或@SpringBootTest(classes=...)注解来指定你的测试类。这个异常通常是因为在Spring Boot应用程序的测试中没有正确配置所导致的。要解决这个问题,你可以添加@ContextConfiguration或@SpringBootTest(classes=...)注解,并确保你的测试类中引入了正确的配置类。这样就可以正确地加载Spring Boot应用程序的上下文,并解决这个异常。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [ Unable to find a @SpringBootConfiguration, you need to use @ContextConfiguration](https://blog.csdn.net/wwwwwww31311/article/details/115461920)[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^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 33.333333333333336%"]
- *2* [Unable to find a @SpringBootConfiguration, you need to use @ContextConfiguration or @SpringBootTest](https://blog.csdn.net/weixin_44797182/article/details/121132167)[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^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 33.333333333333336%"]
- *3* [解决: Unable to find a @SpringBootConfiguration, you need to use @ContextConfiguration or @...](https://blog.csdn.net/androidcw/article/details/122178132)[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^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 33.333333333333336%"]
[ .reference_list ]
阅读全文