Quantcast
Channel: Active questions tagged rest - Stack Overflow
Viewing all articles
Browse latest Browse all 3655

Creating a Feign configuration just for one client?

$
0
0

I have a whole bunch of Feign clients that uses a shared configuration(MyFeignConfiguration.class):

@FeignClient(name = "clientA", url = "http://serviceA.com", fallbackFactory = ServiceAFallbackFactory.class, configuration = MyFeignConfiguration.class)@FeignClient(name = "clientB", url = "http://serviceB.com", fallbackFactory = ServiceBFallbackFactory.class, configuration = MyFeignConfiguration.class)@FeignClient(name = "clientC", url = "http://serviceC.com", fallbackFactory = ServiceCFallbackFactory.class, configuration = MyFeignConfiguration.class)

However, for a new client, I want to change the underlying Http Client that is used to OkHttp one. In the MyFeignConfiguration class, I can add the following:

@Configurationclass MyFeignConfiguration {    @Bean    public Client getClient() {        return OkHttpClient() // use the OkHttp client     }    @Bean    public ErrorDecoder getErrorDecoder() {        //... existing configs    }

However, now all of the clients are using this OkHttp client. How do configure the new feign client so that only it is using the OkHttp client? Also, I still need to use the existing default configs(like the ErrorDecoder) from my main MyFeignConfiguration class.


Viewing all articles
Browse latest Browse all 3655

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>