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

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
© 2021 jiaocheng.bubufx.com  联系我们
ICP备案:鲁ICP备09046678号-3