I am implementing a REST service with Spring Boot and I have an architectural doubt:
I have my @RestController (controller layer) where I check and take the request parameters of my service.
I have a @Service (business layer) where I get some information from other REST services and apply some logic to return it to the controller.
My question is, where is the best place or layer to write the logic to implement the call to the other REST Services and get the objects I need from them?
I am thinking to create another layer, where I provide, through dependency injection, the information to the @Service, is this ok? Is there a better way to do it? Which stereotype annotation would fit in these classes?
I like the dependency inversion principle.
1) Create an interface with the expected baheviour.
2) Create implementation of it as a service, which maps to external dependency.
3) Inject the interface dependency in your business layer and use it.