title: Make API multiple times with AsyncRestTemplate and wait for all to complete
body: <p>I have to make Rest API invocation using RestTemplate multiple time with different parameters. API is same but it is the parameter that is getting changed. Number of times is also variable. I want to use AsyncRestTemplate but my main Thread should wait until all API calls have been successfully completed. I also want to work with responses that each API call returned. Currently I am using RestTemplate. In basic form it is as following. </p>
  
  <pre><code>List&lt;String&gt; listOfResponses = new ArrayList&lt;String&gt;();
  for (Integer studentId : studentIdsList) {
      String respBody;
      try {
          ResponseEntity&lt;String&gt; responseEntity = restTemplate.exchange(url, method, requestEntity, String.class);
      } catch (Exception ex) {
          throw new ApplicationException("Exception while making Rest call.", ex);
      }
      respBody = requestEntity.getBody();
      listOfResponses.add(respBody);          
  }
  </code></pre>
  
  <p>How can I implement AsyncRestTemplate in this situation? </p>