Microservice - Declarative Rest Client with Spring Cloud OpenFeign
Go Back to Course Outline Spring Cloud OpenFeign A declarative web service client originally created by Netflix and is part of the ...

Go Back to Course Outline
Spring Cloud OpenFeign
- A declarative web service client originally created by Netflix and is part of the Spring Cloud set of libraries.
- It allows calling a REST service with only an annotated interface class by proxying the request to the actual microservice.
- Spring Cloud integrates OpenFeign with Ribbon, Eureka and Load balancer to provide a load balance request.
Adding OpenFeign to our Project
- Add the following dependencies:
- spring-cloud-starter-openfeign
- spring-cloud-starter-netflix-ribbon
- Annotate the SpringBoot class with @EnableFeignClients.
- Create an interface annotated with @FeignClient and specify the value as the name of our service. For example “catalog”, since our application is a Eureka client, it will resolve the service in the Eureka service registry.
- In the interface define the proxy REST methods.
Feign Client
How to use Feign Client?
Load Balancing
HATEOAS
References
- https://cloud.spring.io/spring-cloud-openfeign/reference/html/
- Codes are available at Github:
Post a Comment