I am developing a Spring Boot Application which consumes another REST service to get the User’s Account information. The same service provides multiple operations like:
GET: /userid/retrive -to get user and account information
POST: /user/create – to create a new user
POST: /userid/save – to save the user information
DELETE: /userid – to remove the user information from the system
POST: /userid/account : to update account information
So All the above apis are exposed by one service. Some of them return the same response object while others do not and each of them have their own request parameters and request headers that should be set before calling.
So what I have done is I have created a Base class which will have the common code and I have extended it for One Rest template per API operation which will set its own request parameters and call the service and also has different exception loggers/messages.
The service also exposes other operations which we start consuming in our upcoming sprints, and I wanted to make sure if we can utilize any existing design pattern for our advantage.
So I am writing this question to know if there are any alternatives or any design patterns you could suggest so as calling the same service would not have multiple rest templates.