since future projects will use Spring boot technology as the theme, these days have tried Springboot+dubbo to complete the layering of business architectures, this article mainly records the Dubbo null pointer problems encountered during SPRINGBOOT construction.
First, we recommend that you have a channel to this problem and take a look at this article
Http://www.oschina.net/question/1011127_144093?fromerr=7pRd3NKv
Although this article does not solve the problem of springboot configuration, but to solve this problem provides the idea, SPRINGBOOT+DUBBO null pointer problem, the main reason:Spring Scan is not recognized at all @Reference , on the same side, the Dubbo scan also does not recognize the spring @Controller , so the sequence of two scans should be arranged, if the controller is first swept, then the controllers are instantiated, and then sweep the Dubbo service, there will be a null pointer.
The following code is provided:
Dubbo-provider.xml: The provider scans the spring framework, completes the spring portion of the scan, and then serves the Dubbo framework, in contrast to the consumer part, scanning the Dubbo service first, then scanning the spring part ~
<mvc:annotation-driven/> <!--consumer app name, used to calculate dependencies, not match criteria, not as provider--<dubbo:application name= "Dubbo-con Sumer "owner=" programmer "organization=" Dubbox "/> <dubbo:registry address=" zookeeper://127.0.0.1:2181 "/> <dubbo:consumer timeout= "30000"/> <!--<dubbo:reference id= "Demoservice" interface= "Com.dubbo.service.D Emoservice "/>-<dubbo:annotation package=" Com.dubbo.controller "/> <!--convert classes marked @controller annotations to Beans --<context:component-scan base-package= "Com.dubbo.controller"/>
Production test: 53039491
SPRINGMVC Dubbo Consumer @Reference Comment is invalid, service layer returns null pointer