September 2019
Intermediate to advanced
668 pages
15h 59m
English
Let's look at the integration component, ProductCompositeIntegration.java. It is declared as a Spring Bean using the @Component annotation and implements the three core services' API interfaces:
package se.magnus.microservices.composite.product.services;@Componentpublic class ProductCompositeIntegration implements ProductService, RecommendationService, ReviewService {
The integration component uses a helper class in Spring Framework, RestTemplate.java, to perform the actual HTTP requests to the core microservices. Before we can inject it into the integration component, we need to configure it. We do that in the main application class, ProductCompositeServiceApplication.java, as follows:
@BeanRestTemplate restTemplate() ...