✅ 操作成功!

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

发布时间:2023-06-12 作者:admin 来源:文学

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

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

问题描述:

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注解自动装配。所有自动装配该接口的注解保持一致。

👁️ 阅读量:0