Reputation: 12447
We have a specific config in FeignClientConfiguration.java:
@Configuration
public class FeignClientConfiguration {
@Bean
public BasicAuthRequestInterceptor basicAuthRequestInterceptor() {
return new BasicAuthRequestInterceptor(username, password);
}
}
Then in one feign client in one package we have the following so that it will use the above configuration:
@FeignClient(name = "my-client", url = "https://myurl/", configuration = FeignClientConfiguration.class)
public interface MyFeignClient {
@RequestMapping(...
}
In a separate feign client, which has a completely different purpose and endpoint, we have:
@FeignClient(name = "some-other-client", url = "https://different-url/")
public interface OtherFeignClient {
@RequestMapping(...
}
The problem is that the second one is also getting the config from FeignClientConfiguration for some reason. How do we restrict a configuration class to a single feign client?
Upvotes: 0
Views: 23
Reputation: 12447
I found a solution. It turns out if you add @Configuration on the feign config class, it adds it to ALL feign clients, regardless.
The solution was to remove @Configuration, then rely on the @FeignClient(..configuration = FeignClientConfiguration.class) to link them.
The popular examples on the internet do both, which appears to be wrong.
Upvotes: 0