SpringBoot basics: integrating Dubbo
1. Basic knowledge
a. Interface engineering: stores the Model and Service interfaces
b. Service provider: The implementation class of the service interface exposes the service, registers it in the registration center, and calls the data persistence layer. (big head)
- Add dependencies (dubbo, registration center, interface project)
- Configure core configuration file
c. Service consumer: handles browser requests and calls services provided by service providers from the registration center
- Add dependencies (dubbo, registration center, interface project)
- Configure core configuration file
2. Service consumers find service providers
- 1 Use
@Component
annotations to put the service interface implementation class into the springboot container. - 2 Use dubbo
@Service
annotations to register the service interface implementation class to the registration center. - 3 Use dubbo
@Reference
annotations to call the service interface implementation class (@Autowired is no longer used). - 4 Add dubbo startup annotations to the service provider and service consumer startup classes.
@EnableDubboConfiguration
.
Notice: @Service
and@Reference
are alldubbo
comments.