dubbo version: 2.7.3
os version: Windows 10
jdk version: 1.8
I met a problem when I learn to use the "url" config in dubbo:reference. I choose zookeeper as registry.
I have these codes in my provider.
interface GreetingService {
String sayHello(String name);
}
class GreetingServiceImpl implements GreetingService {
String sayHello(String name) {
return "hello, " + name;
}
}
I have these configs in my provider.xml
<bean id="target1" class="com.....GreetingServiceImpl" />
<bean id="target2" class="com.....GreetingServiceImpl" />
<dubbo:service interface="com....GreetingService" ref="target1" group="group1" version="2.0.0"/>
<dubbo:service interface="com...GreetingService" ref="target2" group="group2" version="2.0.0" />
Situation 1.
In this case, the consumer will work.
<dubbo:reference check="false" url="dubbo://127.0.0.1:20880?group=group1&version=2.0.0" id="mergerService" interface="com.maslke.dubbo.samples.merger.api.MergerService" group="group1" version="2.0.0" />
Situation 2.
In this case, the consumer will not work. It will throw an exception like this "Not found exported service".
<dubbo:reference check="false" url="dubbo://127.0.0.1:20880?group=group2&version=2.0.0" id="mergerService" interface="com.maslke.dubbo.samples.merger.api.MergerService" group="group2" version="2.0.0" />
Situation3.
I modify my provider.xml and add id to dubbo:service.
<bean id="target1" class="com.....GreetingServiceImpl" />
<bean id="target2" class="com.....GreetingServiceImpl" />
<dubbo:service id="greetingService" interface="com....GreetingService" ref="target1" group="group1" version="2.0.0"/>
<dubbo:service id="greetingServic2" interface="com...GreetingService" ref="target2" group="group2" version="2.0.0" />
If I do this,situation 1 and situation 2 will both work correctly.
So here is the question.
- Is this a bug?
- if this is not a bug, so id is necessary in my situation?
dubbo version: 2.7.3
os version: Windows 10
jdk version: 1.8
I met a problem when I learn to use the "url" config in dubbo:reference. I choose zookeeper as registry.
I have these codes in my provider.
I have these configs in my provider.xml
Situation 1.
In this case, the consumer will work.
Situation 2.
In this case, the consumer will not work. It will throw an exception like this "Not found exported service".
Situation3.
I modify my provider.xml and add id to dubbo:service.
If I do this,situation 1 and situation 2 will both work correctly.
So here is the question.