To enable client side load balancing, @LoadBalanced annotation can be used on RestTemplate.
@Bean @LoadBalanced public RestTemplate getRestTemplate() { return new RestTemplate(); }
Note: Do not use @LoadBalanced annotation if you are using hard-coded URLs for Development or Testing purpose otherwise exception will be thrown.
It is required to use @LoadBalanced annotation if you are using service ids instead of hard-coded URLs.