May 2018
Intermediate to advanced
390 pages
9h 31m
English
You can create your own Feign client by using Feign.builder() to configure our interface-based client. Let's see the following class, which creates two Feign clients using the same interface:
@Import(FeignClientsConfiguration.class)
@RestController
class CustomerController {
private AccountService customerAccuntService;
private AccountService adminAccuntService;
@Autowired
public CustomerController(
Decoder decoder, Encoder encoder, Client client, Contract contract) {
this.customerAccuntService = Feign.builder().client(client)
.encoder(encoder)
.decoder(decoder)
.contract(contract)
.requestInterceptor(new BasicAuthRequestInterceptor("customer", "customer")) .target(AccountService.class, "http://ACCOUNT-SERVICE"); this.adminAccuntService ...Read now
Unlock full access