February 2019
Intermediate to advanced
442 pages
11h 46m
English
The problem in the first approach is that we still have to define the instance URLs manually. With Eureka, we can use its ability to resolve the microservice name dynamically and no more hardcore URLs are required. With Eureka, things are more straightforward. The Ribbon and Feign configuration will be changed as follows:
@FeignClient(name="catalog-service", path="/api/catalog" )@RibbonClient(name="catalog-service")public interface CatalogServiceProxy { @GetMapping("/get-book/{bookId}") public ResponseEntity<BookDTO> getInventory(@PathVariable("bookId") Integer bookId);}
No more url attributes are required for the @FeignClient annotation. Also, you can remove the catalog-service.ribbon.listOfServers property ...