Field baseMapper in com.baomidou.mybatisplus.extension.service.impl.ServiceImpl required a single be

本文介绍了在SpringBoot项目中集成Mybatis-Plus时遇到的应用启动失败的问题。错误信息显示由于存在多个BaseMapper类型的bean,导致无法正常启动。作者怀疑是自己封装的基础接口和实现类与mybatis-plus的接口冲突。解决方案是删除自定义封装,直接使用mybatis-plus提供的基础类。通过这个方法,项目成功启动。欢迎读者分享更多关于此类问题的解决经验。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2019-07-17 09:16:28.739 ERROR 9800 --- [           main] o.s.b.d.LoggingFailureAnalysisReporter   : 

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

Description:

Field baseMapper in com.baomidou.mybatisplus.extension.service.impl.ServiceImpl required a single bean, but 3 were found:
    - miguBusiHisMapper: defined in file [D:\workspaceIdea\ywjc-refactor\target\classes\com\guoll\modules\miguProject\mapper\MiguBusiHisMapper.class]
    - miguBusiInfoMapper: defined in file [D:\workspaceIdea\ywjc-refactor\target\classes\com\guoll\modules\miguProject\mapper\MiguBusiInfoMapper.class]
    - sysUserMapper: defined in file [D:\workspaceIdea\ywjc-refactor\target\classes\com\guoll\modules\sysmanage\mapper\SysUserMapper.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


Process finished with exit code 1

springBoot 集成mybatis-plus 。系统启动报如上错误

      项目介绍:mybatis-plus自己封装了  基础的servie、ServiceImpl及BaseMapper 

                    我自己的项目中,又封装了一层基础的接口、实现类并且分别集成、实现mybatis-plus封装好的以上 基础类

                项目中的接口、实现类继承和实现我自己的封装的基础类,间接继承与实现mybatis-plus封装好的基础类

       产生的原因暂时不清楚,可能怀疑,我自己封装的基础接口、实现类,又集成mybatis-plus中的基础接口、实现类。写的方法存在问题造成的

      解决办法:删除项目中自己封装的基础类,实体类直接集成mybatis-plus封装好的接口与实现类。启动成功

以上是我项目中处理办法。欢迎大家指正。如果谁知道根本原因可以留言

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

mhi()

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值