Java Consider marking one of the beans as @Primary问题解决

编程知识 更新时间:2023-05-02 05:24:06

问题描述:

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

问题分析:

1、使用@Autowired自动装配的接口在另外一个定义的地方使用了Dubbo的@Reference,导致了该接口有两个不同的实现类报错。

解决办法:

自动装配的接口是项目里面的,使用@Autowired注解自动装配。自动装配的接口是其他微服务的,使用@Reference注解自动装配。所有自动装配该接口的注解保持一致。

更多推荐

Java Consider marking one of the beans as @Primary问题解决

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

发布评论

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

>www.elefans.com

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

  • 104365文章数
  • 26212阅读数
  • 0评论数