Could not autowire. No beans of 'OrderMapper' type found.
时间: 2023-10-28 14:24:39 浏览: 123
"Could not autowire. No beans of 'OrderMapper' type found."表示在自动装配(Autowired)过程中找不到'OrderMapper'类型的bean。解决这个问题有以下三种方法:
1. 在OrderMapper接口文件上添加@Repository注解,该注解表示该接口是一个数据访问接口,可以被Spring容器扫描到并创建对应的bean对象。
2. 确保OrderMapper接口继承自BaseMapper<XXX>,并且在接口上使用@Mapper注解,这样Spring会根据该接口创建对应的bean对象。
3. 检查是否正确配置了OrderMapper的实现类,并且实现类上是否有@Component或@Repository注解,这样Spring才能扫描到并创建对应的bean对象。
综上所述,如果出现"Could not autowire. No beans of 'OrderMapper' type found."的错误,可以尝试以上三种解决办法来解决该问题。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *2* [Could not autowire. No beans of ‘xxxMapper‘ type found.](https://blog.csdn.net/weixin_44575373/article/details/126218971)[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: 50%"]
- *3* [自动装配xxxMapper类时提示Could not autowire. No beans of ‘XXXMapper‘ type found](https://blog.csdn.net/lq_bog/article/details/123325096)[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: 50%"]
[ .reference_list ]
阅读全文