Could not autowire. No beans of 'CompanyPolicyMapper' type found.
时间: 2023-09-25 20:14:41 浏览: 153
Idea 解决 Could not autowire. No beans of 'xxxx' type found 的错误提示
5星 · 资源好评率100%
回答: 当出现"Could not autowire. No beans of 'CompanyPolicyMapper' type found."错误时,这意味着Spring容器无法找到名为'CompanyPolicyMapper'的bean。通常情况下,这是由于没有将该类正确地注入到Spring容器中引起的。修复这个问题的一种方法是在注入时使用@Autowired(required=false)来允许该依赖项为空。这样,即使找不到对应的bean,程序也能够成功运行并且不会报错。<em>1</em><em>2</em>
#### 引用[.reference_title]
- *1* [报错:Could not autowire. No beans of ‘EmployeeService‘ type found.](https://blog.csdn.net/qq_37958178/article/details/130638557)[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]
- *2* [Could not autowire. No beans of ‘XXX‘ type found](https://blog.csdn.net/weixin_44096133/article/details/128679145)[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]
[ .reference_list ]
阅读全文