Spring-cloud-netflix: Can I make url and path of feign client dynamic?

Created on 11 Nov 2016  ·  6Comments  ·  Source: spring-cloud/spring-cloud-netflix

Like:

@FeignClient(url=''somethindynamic')
public class MyClient{

    @RequestMapping(path="somethingDynamic")//someway to put url here? <<
    void call()
}
question

Most helpful comment

putting a full url in the @RequestMapping doesn't make much sense. I believe that they both support placeholders as well (ie ${my.prop}).

All 6 comments

putting a full url in the @RequestMapping doesn't make much sense. I believe that they both support placeholders as well (ie ${my.prop}).

I want to use with quartz.. so my basejob will call an Url for real job
service...

The job data contain the Url that I want to pass to Feign

Em Sex, 11 de nov de 2016 18:02, Spencer Gibb [email protected]
escreveu:

putting a full url in the @RequestMapping doesn't make much sense. I
believe that they both support placeholders as well (ie ${my.prop}).


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/spring-cloud/spring-cloud-netflix/issues/1458#issuecomment-260043086,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AEZjAaysfcIbKT__EP1M9yD76fngiC7fks5q9Mm7gaJpZM4KwDm2
.

Closing due to age of the question. If you would like us to look at this issue, please comment and we will look at re-opening the issue.

Is there a way to do this?

One use case is if I want to call a Spring actuator endpoint, but I want to call it for multiple services. Each service sits at its own hostname, and eg. we want to make a health check call to each one.

My use case isn't that exactly, but there's an endpoint that's the same for multiple services, and I want to decide which one I want to call at runtime. Each service has its own hostname.

@mikehfaber not with @FeignClient. That's not really the use case for feign. It's generally tied to a single host (or a group of hosts that are the instances of the same service). You'd have to write a bunch of custom code (I'm sure it could be done), but it would be simpler and more straight forward to use RestTemplate or WebClient in that case.

now i can use placeholder ie ${my.prop} That‘s cool!

Was this page helpful?
0 / 5 - 0 ratings