<ul dir="auto">
<li>[  <g-emoji class="g-emoji" alias="heavy_check_mark" fallback-src="https://github.githubassets.com/images/icons/emoji/unicode/2714.png">✔</g-emoji> ] 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>[ <g-emoji class="g-emoji" alias="heavy_check_mark" fallback-src="https://github.githubassets.com/images/icons/emoji/unicode/2714.png">✔</g-emoji> ] 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.0</li>
<li>Operating System version: MAC</li>
<li>Java version: JDK1.8</li>
</ul>
<h3 dir="auto">Steps to reproduce this issue</h3>
<ol dir="auto">
<li>new a spring boot project with dubbo 2.7.0</li>
<li>new Dubbo Service</li>
<li>use org.apache.dubbo.config.spring.context.annotation.DubboComponentScan</li>
<li>run or debug</li>
</ol>
<p dir="auto">PS: replace  <code class="notranslate">org.apache.dubbo.config.spring.context.annotation.DubboComponentScan</code> with <code class="notranslate">org.springframework.context.annotation.ComponentScan</code> or <code class="notranslate">org.apache.dubbo.config.spring.context.annotation.CompatibleDubboComponentScan</code> ,<br>
then it will work normally.</p>
<p dir="auto">Pls. provide [GitHub address] to reproduce this issue.</p>
<h3 dir="auto">Expected Result</h3>
<p dir="auto">the dubbo service export success and keep alive with zookeeper.</p>
<h3 dir="auto">Actual Result</h3>
<p dir="auto">org.apache.dubbo.config.spring.beans.factory.annotation.ReferenceAnnotationBeanPostProcessor.initReferenceBeanInvocationHandler will throw an NullPointerException, then destroy zookeeper registry</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="Error starting ApplicationContext. To display the auto-configuration report re-run your application with 'debug' enabled.
2019-06-05 09:58:13.773 ERROR org.springframework.boot.SpringApplication Line:771 - Application startup failed
java.lang.NullPointerException: null
	at java.util.concurrent.ConcurrentHashMap.replaceNode(ConcurrentHashMap.java:1106)
	at java.util.concurrent.ConcurrentHashMap.remove(ConcurrentHashMap.java:1097)
	at org.apache.dubbo.config.spring.beans.factory.annotation.ReferenceAnnotationBeanPostProcessor.initReferenceBeanInvocationHandler(ReferenceAnnotationBeanPostProcessor.java:232)
	at org.apache.dubbo.config.spring.beans.factory.annotation.ReferenceAnnotationBeanPostProcessor.onServiceBeanExportEvent(ReferenceAnnotationBeanPostProcessor.java:226)
	at org.apache.dubbo.config.spring.beans.factory.annotation.ReferenceAnnotationBeanPostProcessor.onApplicationEvent(ReferenceAnnotationBeanPostProcessor.java:218)
	at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172)
	at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165)
	at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139)
	at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:393)
	at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:347)
	at org.apache.dubbo.config.spring.ServiceBean.publishExportEvent(ServiceBean.java:328)
	at org.apache.dubbo.config.spring.ServiceBean.export(ServiceBean.java:320)
	at org.apache.dubbo.config.spring.ServiceBean.onApplicationEvent(ServiceBean.java:112)
	at org.apache.dubbo.config.spring.ServiceBean.onApplicationEvent(ServiceBean.java:58)
	at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172)
	at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165)
	at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139)
	at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:393)
	at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:347)
	at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:883)
	at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.finishRefresh(EmbeddedWebApplicationContext.java:144)
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:546)
	at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122)
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:693)
	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:360)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:303)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1118)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1107)
	at com.guahao.dime.service.DimeApplication.main(DimeApplication.java:24)
2019-06-05 09:58:13.785 INFO  org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext Line:984 - Closing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@496a31da: startup date [Wed Jun 05 09:57:55 CST 2019]; root of context hierarchy
2019-06-05 09:58:13.791 INFO  org.apache.dubbo.registry.support.AbstractRegistryFactory Line:66  -  [DUBBO] Close all registries [zookeeper://192.168.99.51:2183/org.apache.dubbo.registry.RegistryService?application=dime-service&amp;backup=192.168.99.37:2183&amp;dubbo=2.0.2&amp;interface=org.apache.dubbo.registry.RegistryService&amp;pid=2022&amp;release=2.7.0&amp;timestamp=1559699887707], dubbo version: 2.7.0, current host: 220.250.64.20
2019-06-05 09:58:13.793 INFO  org.apache.dubbo.registry.zookeeper.ZookeeperRegistry Line:66  -  [DUBBO] Destroy registry:zookeeper://192.168.99.51:2183/org.apache.dubbo.registry.RegistryService?application=dime-service&amp;backup=192.168.99.37:2183&amp;dubbo=2.0.2&amp;interface=org.apache.dubbo.registry.RegistryService&amp;pid=2022&amp;release=2.7.0&amp;timestamp=1559699887707, dubbo version: 2.7.0, current host: 220.250.64.20"><pre class="notranslate"><code class="notranslate">Error starting ApplicationContext. To display the auto-configuration report re-run your application with 'debug' enabled.
2019-06-05 09:58:13.773 ERROR org.springframework.boot.SpringApplication Line:771 - Application startup failed
java.lang.NullPointerException: null
	at java.util.concurrent.ConcurrentHashMap.replaceNode(ConcurrentHashMap.java:1106)
	at java.util.concurrent.ConcurrentHashMap.remove(ConcurrentHashMap.java:1097)
	at org.apache.dubbo.config.spring.beans.factory.annotation.ReferenceAnnotationBeanPostProcessor.initReferenceBeanInvocationHandler(ReferenceAnnotationBeanPostProcessor.java:232)
	at org.apache.dubbo.config.spring.beans.factory.annotation.ReferenceAnnotationBeanPostProcessor.onServiceBeanExportEvent(ReferenceAnnotationBeanPostProcessor.java:226)
	at org.apache.dubbo.config.spring.beans.factory.annotation.ReferenceAnnotationBeanPostProcessor.onApplicationEvent(ReferenceAnnotationBeanPostProcessor.java:218)
	at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172)
	at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165)
	at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139)
	at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:393)
	at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:347)
	at org.apache.dubbo.config.spring.ServiceBean.publishExportEvent(ServiceBean.java:328)
	at org.apache.dubbo.config.spring.ServiceBean.export(ServiceBean.java:320)
	at org.apache.dubbo.config.spring.ServiceBean.onApplicationEvent(ServiceBean.java:112)
	at org.apache.dubbo.config.spring.ServiceBean.onApplicationEvent(ServiceBean.java:58)
	at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172)
	at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165)
	at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139)
	at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:393)
	at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:347)
	at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:883)
	at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.finishRefresh(EmbeddedWebApplicationContext.java:144)
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:546)
	at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122)
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:693)
	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:360)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:303)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1118)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1107)
	at com.guahao.dime.service.DimeApplication.main(DimeApplication.java:24)
2019-06-05 09:58:13.785 INFO  org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext Line:984 - Closing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@496a31da: startup date [Wed Jun 05 09:57:55 CST 2019]; root of context hierarchy
2019-06-05 09:58:13.791 INFO  org.apache.dubbo.registry.support.AbstractRegistryFactory Line:66  -  [DUBBO] Close all registries [zookeeper://192.168.99.51:2183/org.apache.dubbo.registry.RegistryService?application=dime-service&amp;backup=192.168.99.37:2183&amp;dubbo=2.0.2&amp;interface=org.apache.dubbo.registry.RegistryService&amp;pid=2022&amp;release=2.7.0&amp;timestamp=1559699887707], dubbo version: 2.7.0, current host: 220.250.64.20
2019-06-05 09:58:13.793 INFO  org.apache.dubbo.registry.zookeeper.ZookeeperRegistry Line:66  -  [DUBBO] Destroy registry:zookeeper://192.168.99.51:2183/org.apache.dubbo.registry.RegistryService?application=dime-service&amp;backup=192.168.99.37:2183&amp;dubbo=2.0.2&amp;interface=org.apache.dubbo.registry.RegistryService&amp;pid=2022&amp;release=2.7.0&amp;timestamp=1559699887707, dubbo version: 2.7.0, current host: 220.250.64.20
</code></pre></div>