Consuming endpoints using a declarative method
Another way of writing client applications for microservices is through the use of Spring Cloud Netflix Feign which utilizes a declarative and easy mechanism of writing clients for RESTful endpoints.
Getting started
Create a new Spring Boot application that is an independent specimen on how to enable Feign as the client solution in a client Spring Boot application that aims to consume exposed web services from typical or Eureka-registered microservices.
How to do it...
Apply the Feign client solution to Spring Boot application by the following steps:
- Create a Maven project
ch10-feignthat contains core starter POM such aswebflux, actuator, and Tomcat server for Spring Boot 2.0 with the addition of the needed Spring Cloud dependent management configuration which is Spring Cloud Finchley. - Add the following Spring Cloud Netflix Feign dependency in the
pom.xml.
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId...