April 2018
Intermediate to advanced
432 pages
10h 38m
English
An approach where only an interface with some annotations has to be created to provide a component is standard for Spring Framework. For Feign, an interface must be annotated with @FeignClient(name = "..."). It has one required property name, which corresponds to the invoked microservice name if service discovery is enabled. Otherwise, it is used together with the url property, where we can set a concrete network address. @FeignClient is not the only annotation that needs to be used here. Every method in our client interface is associated with a specific HTTP API endpoint by marking it with @RequestMapping or more concrete annotations, such as @GetMapping, @PostMapping, or @PutMapping, as in this example source code ...