Using Spring Cloud Netflix – Feign
In the previous recipe, we looked at how to enable service discovery capability for our application in order to be able to register our service with the world as well as to know what other services exist and where they are located. This recipe will help us better interact with that information and consume those services without having to explicitly code any logic to handle service discovery and all of the related concerns that come with it.
To achieve this goal, we will look at another Spring Cloud integration, provided by the Spring Cloud Netflix module family—Netflix Feign. Feign, which makes writing Java HTTP clients easier. Its purpose is to simplify the process of binding service API calls to their corresponding HTTP API counterparts. It provides automatic service mapping and discovery, ability to translate Java types to HTTP request URL paths, parameters and response payloads, as well as error handling.
For the sake of simplicity, in this recipe, we...