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"); ...