Search code examples
javaspringnetflixfeign

How to make FeignClient use name over url?


I have a @FeignClient interface:

@FeignClient(name="${some.service.id}", url="${some.service.url}")
public interface SomeInterface {
...
}

My question is- how can I direct feign to use one of the two properties (name/url)? I left the url property empty in the production properties file, but it seems as if it always uses the url property.


Solution

  • So eventually I found a suitable solution here: Define different Feign client implementations based on environment

    Although I wanted to solve this using only one feign client with configuration and profiles, I didn't find a way to do it. This solution is based on creating two different feign clients, each will be used in the right profile.