首页 > 移动平台 > 详细

springboot+mybatis,扫描不到mapper

时间:2021-05-21 18:20:20      阅读:56      评论:0      收藏:0      [点我收藏+]
  • 无法扫描到接口实现,‘com.sclp.mapper.GenTableMapper‘ that could not be found.
Description:

Field genTableService in com.sclp.controller.GenController required a bean of type ‘com.sclp.mapper.GenTableMapper‘ that could not be found.

The injection point has the following annotations:
	- @org.springframework.beans.factory.annotation.Autowired(required=true)


Action:

Consider defining a bean of type ‘com.sclp.mapper.GenTableMapper‘ in your configuration.

需要在主启动类和mapper接口上分别使用@MapperScan@Mapper,将mapper注入spring容器;

  • @MapperScan注解将非mapper接口扫描到容器,Field genTableService in com.sclp.controller.GenController required a single bean, but 2 were found
Description:

Field genTableService in com.sclp.controller.GenController required a single bean, but 2 were found:
	- genTableServiceImpl: defined in file [D:\Work_soft\Workplace\sclp\sclp-gen\target\classes\com\sclp\service\impl\GenTableServiceImpl.class]
	- IGenTableService: defined in file [D:\Work_soft\Workplace\sclp\sclp-gen\target\classes\com\sclp\service\IGenTableService.class]


Action:

Consider marking one of the beans as @Primary, updating the consumer to accept multiple beans, or using @Qualifier to identify the bean that should be consumed

在使用@MapperScan注解时指定扫描范围@MapperScan(basePackages={"com.sclp.mapper"})

springboot+mybatis,扫描不到mapper

原文:https://www.cnblogs.com/jinit/p/14794150.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!