spring-cloud-openfeign icon indicating copy to clipboard operation
spring-cloud-openfeign copied to clipboard

[Feature Request]: feign.Target.url should be RefreshScope bean to refresh URL of a feign client instance

Open jas34 opened this issue 3 years ago • 7 comments
trafficstars

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.

jas34 avatar May 08 '22 06:05 jas34

May I have any feedback?

jas34 avatar May 19 '22 16:05 jas34

May I have any feedback?

jas34 avatar Jun 06 '22 03:06 jas34

Hello @jas34 , thanks for reporting the issue. We'll discuss it within the team and get back to you.

OlgaMaciaszek avatar Sep 05 '22 13:09 OlgaMaciaszek

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 avatar Sep 08 '22 14:09 OlgaMaciaszek

@OlgaMaciaszek, I will be happy to contribute. I will start working on this next week, expect PR soon.

jas34 avatar Sep 09 '22 03:09 jas34

Sounds great, @jas34 .

OlgaMaciaszek avatar Sep 09 '22 10:09 OlgaMaciaszek

@OlgaMaciaszek here is PR https://github.com/spring-cloud/spring-cloud-openfeign/pull/766

jas34 avatar Oct 09 '22 14:10 jas34