Annotation-based Dubbo service configuration method (example explanation)
Annotation-based Dubbo service configuration can greatly reduce the amount of Service configuration in the dubbo xml configuration file, the main steps are as follows:
I. Service provider
1. Add Dubbo annotation scan to Dubbo configuration file
Add Dubbo Service annotations to the 2.Service implementation class
Import com.alibaba.dubbo.config.annotation.Service;@Servicepublic class DubboServiceImpl implements DubboService {}
II. Service consumers
1. Add Dubbo annotation scan to Dubbo configuration file (same as service provider)
Introduce dubbo configuration into 2.Spring MVC configuration to solve the problem of incompatibility of dubbo annotations (it is critical, otherwise the introduction of services in the controller will report null pointers)
3. Once the Dubbo service is introduced into the controller, you can use the
@ Referenceprivate DubboService dubboService
The above annotation-based Dubbo service configuration method (example explanation) is all the content shared by the editor to you. I hope I can give you a reference and support it.