You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by GitBox <gi...@apache.org> on 2021/08/18 04:07:38 UTC
[GitHub] [dubbo] kylixs edited a comment on issue #8504: 注解与JavaConfig与service group分组写法的迷惑?
kylixs edited a comment on issue #8504:
URL: https://github.com/apache/dubbo/issues/8504#issuecomment-900795175
一般来说,当存在某个type的多个候选bean时,可以通过`@Qualifier` 来指定注入的beanName, `@DubboReference`注解处理时默认以fieldName作为beanName。
消费者的JavaConfig代码如下:
```java
@Configuration
public class JavaConfigDubbo {
@DubboReference(group = "IServer1_A")
private IService1 iService1;
@DubboReference(group = "IServer1_B")
private IService1 iService2;
}
```
消费者的Controller代码如下:
```java
@RestController
public class TestCcontroller {
@Qualifier("iService1")
@Autowired
private IService1 service1_1;
@Qualifier("iService2")
@Autowired
private IService1 service1_2;
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org