Client customization

Client customization can be performed not only with the Feign Builder API, but also by using the annotation-like style. We may provide a configuration class by setting it with the configuration property of @FeignClient:

@FeignClient(name = "account-service", configuration = AccountConfiguration.class)

An example configuration bean is shown here:

@Configurationpublic class AccountConfiguration { @Bean public Contract feignContract() {     return new JAXRSContract(); } @Bean public Encoder feignEncoder() {     return new JAXBEncoder(); } @Bean public Decoder feignDecoder() {     return new JAXBDecoder(); } @Bean public BasicAuthRequestInterceptor basicAuthRequestInterceptor() { return new BasicAuthRequestInterceptor("user", "password"); ...

Get Mastering Spring Cloud 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.