SpringBoot注入Mapper提示Could not autowire. No beans of 'xxxMapper' type found错误

通过用Mabatis的逆向工程生成的Entity和Mapper。在Service层注入的时候一直提示Could not autowire. No beans of 'xxxMapper' type found

这里报错是:UserMapper是个接口。

解决办法1:

解决办法2:在Mapper加上@Repository

原文地址:https://www.cnblogs.com/EmilZs/p/10755239.html