I have global request interceptor
@Bean
public RequestInterceptor requestInterceptor() {
return new OAuth2FeignRequestInterceptor(new DefaultOAuth2ClientContext(), resource());
}
It should be applied to every feign client except for one, in which I have local configuration with following interceptor
@Bean
public RequestInterceptor basicAuthRequestInterceptor() {
return new BasicAuthRequestInterceptor(username, password);
}
Applied as following
@FeignClient(name = "name, url = "${service.url}", configuration = ClientConfiguration.class)
Problem is that in the end both interceptors are applied for request and it leaves me with only one Auth header (OAuth one).
Is it possible to overcome this problem? Override default configuration? Exclude interceptor? Some other way?