spring-cloud-openfeign
spring-cloud-openfeign copied to clipboard
[Feature Request]: feign.Target.url should be RefreshScope bean to refresh URL of a feign client instance
In the integration environment we need to frequently change feign client url due to some unavoidable circumstances
Deploying application everytime after change in the feign client url is not a wise idea. Feign comes with out of the box support for loading URL through configuration property feign.client.{contextId}.url. Since this property is applied at the application startup during FeignClient instance creation and there is no way to refresh these settings via /actuator/refresh. However, feign client connectTimeout and readTimeout are refreshable with the enablement of the property feign.client.refresh-enabled.
Possible solution
Whenever feign.client.refresh-enabled=true then FeignClient constructed from org.springframework.cloud .openfeign.FeignClientFactoryBean should be composed with Refresh scoped ReferableHardCodedTarget<T> (new target extending feign.HardCodedTarget<T>). ReferableHardCodedTarget<T> will have refreshcoped URL bean RefreshableUrl instead of url property of type string.
Then /actuator/refresh will be able to refresh feign.client.{contextId}.url via RefreshableUrl bean.
Feature demand After looking at issue #483, I have realised that many of us are expecting this feature to be available. Refer to this comment.
Additional context If the request looks justified then I will be happy to contribute the same.
May I have any feedback?
May I have any feedback?
Hello @jas34 , thanks for reporting the issue. We'll discuss it within the team and get back to you.
Hello, @jas34 I have marked it as an enhancement, but I'm not sure how soon I'll be able to work on it. Would you like to submit a PR?
@OlgaMaciaszek, I will be happy to contribute. I will start working on this next week, expect PR soon.
Sounds great, @jas34 .
@OlgaMaciaszek here is PR https://github.com/spring-cloud/spring-cloud-openfeign/pull/766