首页 > 移动平台 > 详细

Mybatis MapperScan basePackages

时间:2021-07-20 17:57:43      阅读:31      评论:0      收藏:0      [点我收藏+]

 项目中,两个模块中都放了 Mapper,如下所示

@MapperScan(basePackages ={"com.vipsoft.his.mapper","com.vipsoft.his.sdfyy.mapper"} )

为了方便,两个合成了一个,

@MapperScan(basePackages ={"com.vipsoft.his"} )

问题来了

***************************
APPLICATION FAILED TO START
***************************

Description:

Field fromHisApi in com.vipsoft.his.web.controller.CustodyController required a single bean, but 2 were found:
  - fromHisApiImpl: defined in file [D:\Projects\80.HIS\Test\Master\vipsoft-his-sdfyy\target\classes\com\vipsoft\his\sdfyy\service\impl\FromHisApiImpl.class]
  - IFromHisApi: defined in file [D:\Projects\80.HIS\Test\Master\vipsoft-his-api\target\classes\com\vipsoft\his\api\IFromHisApi.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

解决办法【不好】:在实现类上增加 @Primary,或者在调用的地方加上 @Qualifier("fromHisApiImpl") 

 

Mybatis MapperScan basePackages

原文:https://www.cnblogs.com/vipsoft/p/15035802.html

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