Spring Cloud also supports the implementation of load balancing using RestTemplate. In this case, you need to expose the RestTemplate instance with load balancing capabilities instead of using it directly, as follows:
@LoadBalanced @Bean RestTemplate restTemplate() { return new RestTemplate(); }
@Autowired
RestTemplate restTemplate;
In the previous case, the @LoadBalanced annotation will do the magic of balancing the load between the instances of other services to which we make a REST call. You need to inject this object in your controller and make the call with it.