FeignClient Service Invocation: Spring Guide
In Spring Boot, Feign is a declarative HTTP client that simplifies writing inter-service calls. The Feign client uses proxy objects to call methods on remote services based on interface definitions.
To make service calls between services using Feign, you need to start by defining an interface and annotating it with @FeignClient. Specify the name or URL of the remote service to be called. Then, define the methods to be called in the interface and use Spring MVC annotations to annotate these methods, such as @PathVariable, @RequestParam, etc.
Next, inject the Feign client interface into the application, then simply call the methods defined in the interface to achieve inter-service communication. Feign will automatically build HTTP requests based on the interface definition and return the results to the caller.
In general, Feign clients simplify inter-service communication by defining interfaces and using annotations, allowing developers to focus only on the interface definition and usage without worrying about the specifics of constructing and handling HTTP requests.