I want to use @FeignClient to take URL from property on the bases of environment on that it's run.
like: i have test
, dev
and prod
. All these enviroment have different URL for example :
test
: http://localhost:9000
dev
: http://localhost:8080
prod
: http://localhost:8181
@FeignClient(name = "my-test-servies", url = "${com.test.my.access.url}")
@RequestMapping(method = RequestMethod.GET, value = "/authors")
public interface MyFeignClient {
public List<Author> getAuthors();
}
This works but I want the URL property to be changed based on enviroment. As i am using single property file My yml property file is as below : application.yml
com:
prod:
my:
access:
url: "http://localhost:8181"
test:
my:
access:
url: "http://localhost:9000"
dev:
my:
access:
url: "http://localhost:8080"
Can it be done and if yes; how?