Hi all,
currently it's already possible to configure things like timeout or ssl validation in FeignHttpClientProperties.
My current project requires me to use a http proxy to connect with external services. There are multiple approaches documented on StackOverflow and co but most of them require the usage of manually build FeignClients.
The current solution I implemented is a new Properties configuration which contains a ProxyHost and ProxyPort property. If any of those is set, I overwrite the configuration from OkHttpFeignLoadBalancedConfiguration and set the Proxy in public okhttp3.OkHttpClient client(...).
This way all OkHttpClients will use a configured proxy and I don't need to do it manually.
Wouldn't that be a useful extension of the spring-cloud-openfeign project?
Comment From: ryanjbaxter
You can already do this to some extent by providing your own HTTP client beans http://cloud.spring.io/spring-cloud-static/Finchley.RC2/single/spring-cloud.html#http-clients
Comment From: deveth0
Ah cool, another approach ;) Currently I have a custom starter which provides the okhttp3.OkHttpClient as Bean with Primary annotation (basically a copy of https://github.com/spring-cloud/spring-cloud-openfeign/blob/master/spring-cloud-openfeign-core/src/main/java/org/springframework/cloud/openfeign/ribbon/OkHttpFeignLoadBalancedConfiguration.java) This works fine but imho this would also be a good addition to the possibility to configure the timeouts or ssl validation here.
Ok short update: Providing a custom OkHttpClientFactory is preferable to my current approach!
Comment From: radhakrishna67
I am looking for complete code base for this solution. Please help with this.
Comment From: deveth0
I took some time and implemented a spring-boot-starter that brings in the required functionality: https://github.com/deveth0/httpclient-spring-boot-starter