No qualifying bean of type 'XXX' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}
时间: 2023-09-28 13:08:29 浏览: 169
出现错误"No qualifying bean of type 'XXX' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}"的原因是没有找到符合自动装配条件的bean。
通常,这种错误是由于注入的bean类型与实际存在的bean类型不匹配所导致的。解决这个问题有几种方法可以尝试。一种方法是检查注入的bean类型是否正确,确保它与实际存在的bean类型一致。另一种方法是检查是否存在重复的注解或配置,这可能导致重复注入相同类型的bean。
另外,这个错误也可能是由于项目的依赖问题造成的。可以通过检查项目的POM文件,确保只引入了必要的依赖,并排除无关的依赖。同时,确保POM文件的父级管理正确配置。如果遇到类似的问题,不能通过网络上的解决方案解决,可以仔细检查自己的POM文件,确保依赖配置正确。
综上所述,解决"No qualifying bean of type 'XXX' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}"错误的方法包括:
1. 检查注入的bean类型是否正确,并确保它与实际存在的bean类型一致。
2. 检查是否存在重复的注解或配置,避免重复注入相同类型的bean。
3. 检查项目的POM文件,确保只引入了必要的依赖,并排除无关的依赖,同时确保POM文件的父级管理正确配置。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations](https://blog.csdn.net/qinjiangcai/article/details/125880816)[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_2"}}] [.reference_item style="max-width: 33.333333333333336%"]
- *2* [java种菜源码-springboot-elasticsearch:使用springboot进行spring-data-elastic搜索的示](https://download.csdn.net/download/weixin_38724106/19406400)[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_2"}}] [.reference_item style="max-width: 33.333333333333336%"]
- *3* [spring启动报错:expected at least 1 bean which qualifies as autowire candidate. Dependency ...](https://blog.csdn.net/victo_chao/article/details/130620152)[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_2"}}] [.reference_item style="max-width: 33.333333333333336%"]
[ .reference_list ]
阅读全文