admin管理员组文章数量:1794759
Consider marking one of the beans as @Primary, updating the consumer to accept multiple beans
mybatis-plus报错,之前使用mybatis-plus却没有遇到过的问题
Description: Field baseMapper in com.baomidou.mybatisplus.extension.service.impl.ServiceImpl required a single bean, but 3 were found: - permissionMapper: defined in file [D:XXX\\mapper\\PermissionMapper.class] - userMapper: defined in file [D:XXX\\mapper\\UserMapper.class] - userRoleMapper: defined in file [D:XXX\\mapper\\UserRoleMapper.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 Disconnected from the target VM, address: '127.0.0.1:58072', transport: 'socket' Process finished with exit code 1它也给了两个解决办法 1.把其中一个bean加上@Primary注解,就可以作为默认使用, 2.在注入的属性添加@Qualifier指定beanName,以明确使用哪一个bean 但是经过测试我把其他bean都删掉只剩一个也是报错,所以这两个办法并不能帮助我解决问题。 最后查资料发现可以去扫描一下mp的mapper的路径就没问题了 “com.baomidou.mybatisplus.core.mapper”
如果泛型没有写上可能也会出现这个问题,注意避坑
本文标签: PRIMARYbeansmarkingupdatingmultiple
版权声明:本文标题:Consider marking one of the beans as @Primary, updating the consumer to accept multiple beans 内容由林淑君副主任自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.xiehuijuan.com/baike/1686556908a81563.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论