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.

```java
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

```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.

```xml
<dubbo:reference check="false" 
url="dubbo://127.0.0.1:20880?group=group1&amp;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".

```xml
<dubbo:reference check="false" 
url="dubbo://127.0.0.1:20880?group=group2&amp;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. 

```xml
<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.
1) Is this a bug?
2) if this is not a bug, so id is necessary in my situation?






[ Full content available at: https://github.com/apache/dubbo/issues/5089 ]
This message was relayed via gitbox.apache.org for 
notifications@dubbo.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscr...@dubbo.apache.org
For additional commands, e-mail: notifications-h...@dubbo.apache.org

Reply via email to