Feign inheritance support

We can also inherit interfaces to avoid boilerplate code for the same type of services. Feign allows grouping common operations into convenient base interfaces. Let's see the following example:

@FeignClient(name="account-service") 
public interface AccountService { 
    
   @GetMapping(value = "/account/customer/{customer}") 
   List<Account> findByCutomer (@PathVariable("customer") Integer    customer); 
    
   ... 
} 

We can inherit this interface in the creation of another FeignClient service:

@FeignClient("users") 
public interface AdminAccountService extends AccountService { 
    
   ... 
}

Get Mastering Spring Boot 2.0 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.