解决:Field xxMapper in xx.service.impl.xxServiceImpl required a bean of type 'xx.mapper.xxMapper'...

在这里插入图片描述报错原因,是因为项目未扫描到 mapper 包。

  • 解决方法:

  • 在项目启动类上加注解 @MapperScan(“Mapper文件所在的包”),@MapperScan 是扫描mapper类的注解,就不用在每个mapper类上加@MapperScan了。

  • 重启工程成功运行。

发布了37 篇原创文章 · 获赞 7 · 访问量 1592

猜你喜欢

转载自blog.csdn.net/weixin_43862596/article/details/105590440
今日推荐