Issue 1:

Issue 2:
[ ✔ ] I have searched the issues of this repository and believe that this is not a duplicate.

[ ✔ ] I have checked the FAQ of this repository and believe that this is not a duplicate.

Environment

Dubbo version: 2.7.0

Operating System version: MAC

Java version: JDK1.8

Steps to reproduce this issue

new a spring boot project with dubbo 2.7.0

new Dubbo Service

use org.apache.dubbo.config.spring.context.annotation.DubboComponentScan

run or debug

PS: replace org.apache.dubbo.config.spring.context.annotation.DubboComponentScan with org.springframework.context.annotation.ComponentScan or org.apache.dubbo.config.spring.context.annotation.CompatibleDubboComponentScan ,

then it will work normally.

Pls. provide [GitHub address] to reproduce this issue.

Expected Result

the dubbo service export success and keep alive with zookeeper.

Actual Result

org.apache.dubbo.config.spring.beans.factory.annotation.ReferenceAnnotationBeanPostProcessor.initReferenceBeanInvocationHandler will throw an NullPointerException, then destroy zookeeper registry

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&backup=192.168.99.37:2183&dubbo=2.0.2&interface=org.apache.dubbo.registry.RegistryService&pid=2022&release=2.7.0&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&backup=192.168.99.37:2183&dubbo=2.0.2&interface=org.apache.dubbo.registry.RegistryService&pid=2022&release=2.7.0&timestamp=1559699887707, dubbo version: 2.7.0, current host: 220.250.64.20