<ul dir="auto">
<li>[*] I have searched the <a href="https://github.com/apache/dubbo/issues">issues</a> of this repository and believe that this is not a duplicate.</li>
<li>[*] I have checked the <a href="https://github.com/apache/dubbo/blob/master/FAQ.md">FAQ</a> of this repository and believe that this is not a duplicate.</li>
</ul>
<h3 dir="auto">Environment</h3>
<ul dir="auto">
<li>Dubbo version: 2.7.5-SNAPSHOT</li>
<li>Dubbo branch: master</li>
<li>Operating System version: macOS Catalina</li>
<li>Java version: jdk-11.0.5</li>
</ul>
<h3 dir="auto">Steps to reproduce this issue</h3>
<ol dir="auto">
<li>start zookeeper in localhost and port is 2181</li>
<li>write provider-side code</li>
<li>start provider, the provider-side code looks like this</li>
</ol>
<div class="highlight highlight-source-java notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="public class Application {

	private static String zookeeperHost = System.getProperty(&quot;zookeeper.address&quot;, &quot;127.0.0.1&quot;);

	public static void main(String[] args) throws Exception {
		ServiceConfig&lt;DemoService&gt; service = new ServiceConfig&lt;DemoService&gt;();
		service.setApplication(new ApplicationConfig(&quot;first-dubbo-provider&quot;));
		service.setRegistry(new RegistryConfig(&quot;zookeeper://&quot; + zookeeperHost + &quot;:2181&quot;));
		service.setInterface(DemoService.class);
		service.setRef(new DemoServiceImpl());
		service.export();

		System.out.println(&quot;dubbo service started&quot;);
		new CountDownLatch(1).await();
	}
}"><pre class="notranslate"><span class="pl-k">public</span> <span class="pl-k">class</span> <span class="pl-smi">Application</span> {

	<span class="pl-k">private</span> <span class="pl-k">static</span> <span class="pl-smi">String</span> <span class="pl-s1">zookeeperHost</span> = <span class="pl-smi">System</span>.<span class="pl-en">getProperty</span>(<span class="pl-s">"zookeeper.address"</span>, <span class="pl-s">"127.0.0.1"</span>);

	<span class="pl-k">public</span> <span class="pl-k">static</span> <span class="pl-smi">void</span> <span class="pl-en">main</span>(<span class="pl-smi">String</span>[] <span class="pl-s1">args</span>) <span class="pl-k">throws</span> <span class="pl-smi">Exception</span> {
		<span class="pl-smi">ServiceConfig</span>&lt;<span class="pl-smi">DemoService</span>&gt; <span class="pl-s1">service</span> = <span class="pl-k">new</span> <span class="pl-smi">ServiceConfig</span>&lt;<span class="pl-smi">DemoService</span>&gt;();
		<span class="pl-s1">service</span>.<span class="pl-en">setApplication</span>(<span class="pl-k">new</span> <span class="pl-smi">ApplicationConfig</span>(<span class="pl-s">"first-dubbo-provider"</span>));
		<span class="pl-s1">service</span>.<span class="pl-en">setRegistry</span>(<span class="pl-k">new</span> <span class="pl-smi">RegistryConfig</span>(<span class="pl-s">"zookeeper://"</span> + <span class="pl-s1">zookeeperHost</span> + <span class="pl-s">":2181"</span>));
		<span class="pl-s1">service</span>.<span class="pl-en">setInterface</span>(<span class="pl-smi">DemoService</span>.<span class="pl-k">class</span>);
		<span class="pl-s1">service</span>.<span class="pl-en">setRef</span>(<span class="pl-k">new</span> <span class="pl-smi">DemoServiceImpl</span>());
		<span class="pl-s1">service</span>.<span class="pl-en">export</span>();

		<span class="pl-smi">System</span>.<span class="pl-s1">out</span>.<span class="pl-en">println</span>(<span class="pl-s">"dubbo service started"</span>);
		<span class="pl-k">new</span> <span class="pl-smi">CountDownLatch</span>(<span class="pl-c1">1</span>).<span class="pl-en">await</span>();
	}
}</pre></div>
<h3 dir="auto">Actual Result</h3>
<p dir="auto">But I got an exception.</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="Exception in thread &quot;main&quot; java.lang.NullPointerException
	at org.apache.dubbo.config.AbstractInterfaceConfig.lambda$useRegistryForConfigIfNecessary$7(AbstractInterfaceConfig.java:628)
	at java.base/java.util.Optional.orElseGet(Optional.java:369)
	at org.apache.dubbo.config.AbstractInterfaceConfig.lambda$useRegistryForConfigIfNecessary$8(AbstractInterfaceConfig.java:620)
	at java.base/java.util.Optional.ifPresent(Optional.java:183)
	at org.apache.dubbo.config.AbstractInterfaceConfig.useRegistryForConfigIfNecessary(AbstractInterfaceConfig.java:618)
	at org.apache.dubbo.config.AbstractInterfaceConfig.checkRegistry(AbstractInterfaceConfig.java:208)
	at org.apache.dubbo.config.ServiceConfig.checkAndUpdateSubConfigs(ServiceConfig.java:303)
	at org.apache.dubbo.config.ServiceConfig.export(ServiceConfig.java:370)
	at com.example.studydubboProvider.Application.main(Application.java:22)"><pre class="notranslate"><code class="notranslate">Exception in thread "main" java.lang.NullPointerException
	at org.apache.dubbo.config.AbstractInterfaceConfig.lambda$useRegistryForConfigIfNecessary$7(AbstractInterfaceConfig.java:628)
	at java.base/java.util.Optional.orElseGet(Optional.java:369)
	at org.apache.dubbo.config.AbstractInterfaceConfig.lambda$useRegistryForConfigIfNecessary$8(AbstractInterfaceConfig.java:620)
	at java.base/java.util.Optional.ifPresent(Optional.java:183)
	at org.apache.dubbo.config.AbstractInterfaceConfig.useRegistryForConfigIfNecessary(AbstractInterfaceConfig.java:618)
	at org.apache.dubbo.config.AbstractInterfaceConfig.checkRegistry(AbstractInterfaceConfig.java:208)
	at org.apache.dubbo.config.ServiceConfig.checkAndUpdateSubConfigs(ServiceConfig.java:303)
	at org.apache.dubbo.config.ServiceConfig.export(ServiceConfig.java:370)
	at com.example.studydubboProvider.Application.main(Application.java:22)
</code></pre></div>
<p dir="auto">Is this an issue?</p>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I have searched the <a href="https://github.com/apache/dubbo/issues">issues</a> of this repository and believe that this is not a duplicate.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I have checked the <a href="https://github.com/apache/dubbo/blob/master/FAQ.md">FAQ</a> of this repository and believe that this is not a duplicate.</li>
</ul>
<h3 dir="auto">Environment</h3>
<ul dir="auto">
<li>Dubbo version: 2.7.5</li>
<li>Operating System version: CentOS7</li>
<li>Java version: JDK8</li>
</ul>
<h3 dir="auto">Steps to reproduce this issue</h3>
<p dir="auto">I just updated my application from DUBBO 2.7.3 to 2.7.5. Then I find my 3 group services of same interface lost 2 of them in the registry (NACOS).  I also use <code class="notranslate">dubbo-spring-boot-samples /org.apache.dubbo.spring.boot.demo.provider</code>  to verify and get the same problem. The following are my steps:</p>
<ol dir="auto">
<li>I difine two @Services implementations of a same interface and use "group" to identify each one.</li>
</ol>
<div class="highlight highlight-source-java notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="@service(group=&quot;s1&quot;, version = &quot;1.0.0&quot;)
public class DefaultDemoService implements DemoService {}

@service(group=&quot;s2&quot;, version = &quot;1.0.0&quot;)
public class DefaultDemoService2 implements DemoService {}"><pre class="notranslate"><span class="pl-c1">@</span><span class="pl-c1">service</span>(<span class="pl-s1">group</span>=<span class="pl-s">"s1"</span>, <span class="pl-s1">version</span> = <span class="pl-s">"1.0.0"</span>)
<span class="pl-k">public</span> <span class="pl-k">class</span> <span class="pl-smi">DefaultDemoService</span> <span class="pl-k">implements</span> <span class="pl-smi">DemoService</span> {}

<span class="pl-c1">@</span><span class="pl-c1">service</span>(<span class="pl-s1">group</span>=<span class="pl-s">"s2"</span>, <span class="pl-s1">version</span> = <span class="pl-s">"1.0.0"</span>)
<span class="pl-k">public</span> <span class="pl-k">class</span> <span class="pl-smi">DefaultDemoService2</span> <span class="pl-k">implements</span> <span class="pl-smi">DemoService</span> {}</pre></div>
<p dir="auto">then got the following logs, and  only find service with group s1 has registered in NACOS. If I downgrade dubbo to 2.7.3, everything works well as before.</p>
<div class="highlight highlight-source-shell notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="2020-03-26 18:34:03.243 INFO 12596 --- [ main] b.f.a.ServiceAnnotationBeanPostProcessor : [DUBBO] The BeanDefinition[Root bean: class [org.apache.dubbo.config.spring.ServiceBean]; scope=; abstract=false; lazyInit=null; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null] of ServiceBean has been registered with name : **ServiceBean:org.apache.dubbo.spring.boot.demo.consumer.DemoService:1.0.0:s1**, dubbo version: 2.7.5, current host: ...
2020-03-26 18:34:03.246 INFO 12596 --- [ main] b.f.a.ServiceAnnotationBeanPostProcessor : [DUBBO] The BeanDefinition[Root bean: class [org.apache.dubbo.config.spring.ServiceBean]; scope=; abstract=false; lazyInit=null; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null] of ServiceBean has been registered with name : **ServiceBean:org.apache.dubbo.spring.boot.demo.consumer.DemoService:1.0.0:s2**, dubbo version: 2.7.5, current host: ...

2020-03-26 18:34:04.195 WARN 12596 --- [ main] o.a.dubbo.config.context.**ConfigManager** : [DUBBO] **Duplicate ServiceBean found**, there already has one default ServiceBean or more than two ServiceBeans have the same id, you can try to give each ServiceBean a different id : &lt;dubbo:service beanName=&quot;ServiceBean:org.apache.dubbo.spring.boot.demo.consumer.DemoService:1.0.0:s2&quot; exported=&quot;false&quot; unexported=&quot;false&quot; ref=&quot;org.apache.dubbo.spring.boot.demo.provider.service.DefaultDemoService2@abf688e&quot; prefix=&quot;dubbo.service.org.apache.dubbo.spring.boot.demo.consumer.DemoService&quot; uniqueServiceName=&quot;s2/org.apache.dubbo.spring.boot.demo.consumer.DemoService:1.0.0&quot; interface=&quot;org.apache.dubbo.spring.boot.demo.consumer.DemoService&quot; dynamic=&quot;true&quot; version=&quot;1.0.0&quot; deprecated=&quot;false&quot; group=&quot;s2&quot; id=&quot;**org.apache.dubbo.spring.boot.demo.consumer.DemoService**&quot; valid=&quot;true&quot; /&gt;, dubbo version: 2.7.5, current host: ..."><pre class="notranslate">2020-03-26 18:34:03.243 INFO 12596 --- [ main] b.f.a.ServiceAnnotationBeanPostProcessor <span class="pl-c1">:</span> [DUBBO] The BeanDefinition[Root bean: class [org.apache.dubbo.config.spring.ServiceBean]<span class="pl-k">;</span> scope<span class="pl-k">=</span><span class="pl-k">;</span> abstract<span class="pl-k">=</span>false<span class="pl-k">;</span> lazyInit<span class="pl-k">=</span>null<span class="pl-k">;</span> autowireMode<span class="pl-k">=</span>0<span class="pl-k">;</span> dependencyCheck<span class="pl-k">=</span>0<span class="pl-k">;</span> autowireCandidate<span class="pl-k">=</span>true<span class="pl-k">;</span> primary<span class="pl-k">=</span>false<span class="pl-k">;</span> factoryBeanName<span class="pl-k">=</span>null<span class="pl-k">;</span> factoryMethodName<span class="pl-k">=</span>null<span class="pl-k">;</span> initMethodName<span class="pl-k">=</span>null<span class="pl-k">;</span> destroyMethodName<span class="pl-k">=</span>null] of ServiceBean has been registered with name <span class="pl-c1">:</span> <span class="pl-k">**</span>ServiceBean:org.apache.dubbo.spring.boot.demo.consumer.DemoService:1.0.0:s1<span class="pl-k">**</span>, dubbo version: 2.7.5, current host: ...
2020-03-26 18:34:03.246 INFO 12596 --- [ main] b.f.a.ServiceAnnotationBeanPostProcessor <span class="pl-c1">:</span> [DUBBO] The BeanDefinition[Root bean: class [org.apache.dubbo.config.spring.ServiceBean]<span class="pl-k">;</span> scope<span class="pl-k">=</span><span class="pl-k">;</span> abstract<span class="pl-k">=</span>false<span class="pl-k">;</span> lazyInit<span class="pl-k">=</span>null<span class="pl-k">;</span> autowireMode<span class="pl-k">=</span>0<span class="pl-k">;</span> dependencyCheck<span class="pl-k">=</span>0<span class="pl-k">;</span> autowireCandidate<span class="pl-k">=</span>true<span class="pl-k">;</span> primary<span class="pl-k">=</span>false<span class="pl-k">;</span> factoryBeanName<span class="pl-k">=</span>null<span class="pl-k">;</span> factoryMethodName<span class="pl-k">=</span>null<span class="pl-k">;</span> initMethodName<span class="pl-k">=</span>null<span class="pl-k">;</span> destroyMethodName<span class="pl-k">=</span>null] of ServiceBean has been registered with name <span class="pl-c1">:</span> <span class="pl-k">**</span>ServiceBean:org.apache.dubbo.spring.boot.demo.consumer.DemoService:1.0.0:s2<span class="pl-k">**</span>, dubbo version: 2.7.5, current host: ...

2020-03-26 18:34:04.195 WARN 12596 --- [ main] o.a.dubbo.config.context.<span class="pl-k">**</span>ConfigManager<span class="pl-k">**</span> <span class="pl-c1">:</span> [DUBBO] <span class="pl-k">**</span>Duplicate ServiceBean found<span class="pl-k">**</span>, there already has one default ServiceBean or more than two ServiceBeans have the same id, you can try to give each ServiceBean a different id <span class="pl-c1">:</span> <span class="pl-k">&lt;</span>dubbo:service beanName=<span class="pl-s"><span class="pl-pds">"</span>ServiceBean:org.apache.dubbo.spring.boot.demo.consumer.DemoService:1.0.0:s2<span class="pl-pds">"</span></span> exported=<span class="pl-s"><span class="pl-pds">"</span>false<span class="pl-pds">"</span></span> unexported=<span class="pl-s"><span class="pl-pds">"</span>false<span class="pl-pds">"</span></span> ref=<span class="pl-s"><span class="pl-pds">"</span>org.apache.dubbo.spring.boot.demo.provider.service.DefaultDemoService2@abf688e<span class="pl-pds">"</span></span> prefix=<span class="pl-s"><span class="pl-pds">"</span>dubbo.service.org.apache.dubbo.spring.boot.demo.consumer.DemoService<span class="pl-pds">"</span></span> uniqueServiceName=<span class="pl-s"><span class="pl-pds">"</span>s2/org.apache.dubbo.spring.boot.demo.consumer.DemoService:1.0.0<span class="pl-pds">"</span></span> interface=<span class="pl-s"><span class="pl-pds">"</span>org.apache.dubbo.spring.boot.demo.consumer.DemoService<span class="pl-pds">"</span></span> dynamic=<span class="pl-s"><span class="pl-pds">"</span>true<span class="pl-pds">"</span></span> version=<span class="pl-s"><span class="pl-pds">"</span>1.0.0<span class="pl-pds">"</span></span> deprecated=<span class="pl-s"><span class="pl-pds">"</span>false<span class="pl-pds">"</span></span> group=<span class="pl-s"><span class="pl-pds">"</span>s2<span class="pl-pds">"</span></span> id=<span class="pl-s"><span class="pl-pds">"</span>**org.apache.dubbo.spring.boot.demo.consumer.DemoService**<span class="pl-pds">"</span></span> valid=<span class="pl-s"><span class="pl-pds">"</span>true<span class="pl-pds">"</span></span> /<span class="pl-k">&gt;</span>, dubbo version: 2.7.5, current host: ...</pre></div>
<ol start="2" dir="auto">
<li>I tried add "provider" for <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/service/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/service">@service</a> :</li>
</ol>
<div class="highlight highlight-source-java notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="@service(provider = &quot;defaultDemoService&quot;, group=&quot;s1&quot;, version = &quot;1.0.0&quot;)
public class DefaultDemoService implements DemoService {}

@service(provider = &quot;defaultDemoService2&quot;, group=&quot;s2&quot;, version = &quot;1.0.0&quot;)
public class DefaultDemoService2 implements DemoService {}"><pre class="notranslate"><span class="pl-c1">@</span><span class="pl-c1">service</span>(<span class="pl-s1">provider</span> = <span class="pl-s">"defaultDemoService"</span>, <span class="pl-s1">group</span>=<span class="pl-s">"s1"</span>, <span class="pl-s1">version</span> = <span class="pl-s">"1.0.0"</span>)
<span class="pl-k">public</span> <span class="pl-k">class</span> <span class="pl-smi">DefaultDemoService</span> <span class="pl-k">implements</span> <span class="pl-smi">DemoService</span> {}

<span class="pl-c1">@</span><span class="pl-c1">service</span>(<span class="pl-s1">provider</span> = <span class="pl-s">"defaultDemoService2"</span>, <span class="pl-s1">group</span>=<span class="pl-s">"s2"</span>, <span class="pl-s1">version</span> = <span class="pl-s">"1.0.0"</span>)
<span class="pl-k">public</span> <span class="pl-k">class</span> <span class="pl-smi">DefaultDemoService2</span> <span class="pl-k">implements</span> <span class="pl-smi">DemoService</span> {}</pre></div>
<p dir="auto">then got the fllowing logs:</p>
<div class="highlight highlight-source-shell notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="2020-03-26 22:27:19.428  WARN 7068 --- [           main] s.c.a.AnnotationConfigApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'ServiceBean:org.apache.dubbo.spring.boot.demo.consumer.DemoService:1.0.0:s1': Initialization of bean failed; nested exception is org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'org.apache.dubbo.spring.boot.demo.provider.service.DefaultDemoService' to required type 'org.apache.dubbo.config.ProviderConfig' for property 'provider'; nested exception is java.lang.IllegalStateException: Cannot convert value of type 'org.apache.dubbo.spring.boot.demo.provider.service.DefaultDemoService' to required type 'org.apache.dubbo.config.ProviderConfig' for property 'provider': no matching editors or conversion strategy found"><pre class="notranslate">2020-03-26 22:27:19.428  WARN 7068 --- [           main] s.c.a.AnnotationConfigApplicationContext <span class="pl-c1">:</span> Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name <span class="pl-s"><span class="pl-pds">'</span>ServiceBean:org.apache.dubbo.spring.boot.demo.consumer.DemoService:1.0.0:s1<span class="pl-pds">'</span></span>: Initialization of bean failed<span class="pl-k">;</span> nested exception is org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of <span class="pl-c1">type</span> <span class="pl-s"><span class="pl-pds">'</span>org.apache.dubbo.spring.boot.demo.provider.service.DefaultDemoService<span class="pl-pds">'</span></span> to required <span class="pl-c1">type</span> <span class="pl-s"><span class="pl-pds">'</span>org.apache.dubbo.config.ProviderConfig<span class="pl-pds">'</span></span> <span class="pl-k">for</span> property <span class="pl-s"><span class="pl-pds">'</span>provider<span class="pl-pds">'</span></span><span class="pl-k">;</span> nested exception is java.lang.IllegalStateException: Cannot convert value of <span class="pl-c1">type</span> <span class="pl-s"><span class="pl-pds">'</span>org.apache.dubbo.spring.boot.demo.provider.service.DefaultDemoService<span class="pl-pds">'</span></span> to required <span class="pl-c1">type</span> <span class="pl-s"><span class="pl-pds">'</span>org.apache.dubbo.config.ProviderConfig<span class="pl-pds">'</span></span> <span class="pl-k">for</span> property <span class="pl-s"><span class="pl-pds">'</span>provider<span class="pl-pds">'</span></span>: no matching editors or conversion strategy found</pre></div>
<ol start="3" dir="auto">
<li>I compared the ConfigManager 2.7.3 against 2.7.5, New version add "checkDuplicate" features. I also notice DUBBO may use <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/service/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/service">@service</a>(provider="id") as Bean ID, I tried use this attribute, But also failed with other exceptions.</li>
</ol>
<p dir="auto">Pls. provide [GitHub address] to reproduce this issue.</p>
<p dir="auto"><a href="https://github.com/apache/dubbo-spring-boot-project/tree/master/dubbo-spring-boot-samples/auto-configure-samples/provider-sample">https://github.com/apache/dubbo-spring-boot-project/tree/master/dubbo-spring-boot-samples/auto-configure-samples/provider-sample</a></p>
<h3 dir="auto">Expected Result</h3>
<p dir="auto">I want to use <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/service/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/service">@service</a>(group) to register all my services.</p>
<h3 dir="auto">Actual Result</h3>
<p dir="auto">Encounter 'Duplicate ServiceBean found'、<code class="notranslate">Failed to convert property value of type</code> failure.</p>