admin管理员组文章数量:1130349
项目场景:
SpringBoot+MybatisPlus使用。
问题描述
Could not autowire. No beans of ‘UserMapper’ type found.
原因分析:
没有扫描到
因为这是SpringBoot整合Mybatis的代码,所以在Mapper接口类使用的是@Mapper注解。
但如果每个Mapper接口类都添加@Mapper注解比较麻烦,所以用了@MapperScan注解批量扫描Mapper接口类。
解决方案:
在xxxApplication启动类加上 @MapperScan(“com.xxx.xxx.mapper”)注解。
项目场景:
SpringBoot+MybatisPlus使用。
问题描述
Could not autowire. No beans of ‘UserMapper’ type found.
原因分析:
没有扫描到
因为这是SpringBoot整合Mybatis的代码,所以在Mapper接口类使用的是@Mapper注解。
但如果每个Mapper接口类都添加@Mapper注解比较麻烦,所以用了@MapperScan注解批量扫描Mapper接口类。
解决方案:
在xxxApplication启动类加上 @MapperScan(“com.xxx.xxx.mapper”)注解。
本文标签: 解决方案TypeBeandefiningConfiguration
版权声明:本文标题:Consider defining a bean of type ‘com.service.UserService‘ in your configuration解决方案 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://it.en369.cn/jiaocheng/1738333711a1562296.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。


发表评论