Action: Consider marking one of the beans as @Primary, updating the consumer to accept multiple bean

编程知识 更新时间:2023-05-02 05:30:11

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

 

报错可能是因为使用@Autowired注解,但是该接口下有多个实现,导致spring容器不知道将那个子类注入进来

我出现该问题是一个接口继承另一个接口。

解决方案为:接口不要继承,直接全部copy到新接口上,在新的实现类那边用组合的方式即可,如下

可能还会有其他问题导致该报错,比如Mybatis多数据源导致的,不知道去装载那个database,具体可以参照网上大神的帖子

更多推荐

Action: Consider marking one of the beans as @Primary, updating the consumer to

本文发布于:2023-04-26 06:41:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/8db67d667035bbf468c6f2b01ce8a4bb.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:beans   Primary   Action   marking   updating

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!

  • 104537文章数
  • 26215阅读数
  • 0评论数