Consider defining a bean of type 'com.mlex.mapper.AdminMapper' in your configuration
时间: 2023-10-29 16:18:00 浏览: 161
微信支付学习笔记之调用com.github.binarywang.wxpay.service接口
这个错误提示是说在配置中没有找到类型为'com.mlex.mapper.AdminMapper'的bean。解决这个问题可以考虑以下几个方法:
1. 配置bean: 在你的配置文件中添加一个bean定义,指定类型为'com.mlex.mapper.AdminMapper'。这样spring就可以找到并注入这个bean了。
2. 使用@Mapper注解: 在你的AdminMapper类上添加@Mapper注解,这样spring就会自动扫描并生成AdminMapper的bean,并注入到相关的Service中。这样你就不需要在配置文件中设置扫描地址了。
3. 使用@ComponentScan注解: 在你的主程序上添加@ComponentScan注解,并指定需要扫描的文件夹路径。这样spring就会自动扫描指定文件夹下的所有组件,并生成相应的bean注入到Service中。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *2* [Consider defining a bean of type ‘com.course.server.mapper.TestMapper‘ in your configuration.](https://blog.csdn.net/qq_51453356/article/details/125761322)[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: 50%"]
- *3* [解决问题:Consider defining a bean of type ‘com.xxx.mapper.xxxMapper‘ in your configuration.](https://blog.csdn.net/m0_70734549/article/details/125664152)[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: 50%"]
[ .reference_list ]
阅读全文