0

I'm trying to execute two (or more) REST web services at the same time with restTemplate to improve performance so i want them to be executed simultaneously, how can i do this with spring MVC ?

I mean instead of first webservice + second webservice (2 sec + 2 sec) i will have the two web services running in 2 sec together...

@GetMapping("/findClient/{name}")
public String findClient(@PathVariable String name) {

    String result1 = restTemplate.getForObject("http://localhost:8080/api/getClient1/"+name,String.class);

    String result2 = restTemplate.getForObject("http://localhost:8080/api/getClient2/"+name,String.class);

    String result = result1 + result2;
    return result;
}
slama
  • 85
  • 2
  • 11

0 Answers0