idea中Could not autowire. No beans of 'xxxxMapper' type found.问题解决

时间:2019-07-04 19:37:17   收藏:0   阅读:5990

idea中Could not autowire. No beans of ‘xxxxMapper‘ type found.问题解决

解决方案:

建议给Mapper增加@Repository注解,并加入包名到spring配置文件的扫描范围

技术分享图片

技术分享图片

不建议降低idea的Autowired检测级别

问题复现:

 技术分享图片

说明:

Mapper不需要标注@Repository注解并且无需实现类,是因为mybatis的xml配置文件配置了Mapper工厂,Mapper接口会自动生成实现类,并交由Spring管理。

技术分享图片

 

原文:https://www.cnblogs.com/innerserenity/p/11134075.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!