title: Concurrent asynchronous HTTP requests in Java and/or Spring Boot
body: <p>The issue I need to solve (in Java) is:</p>
  
  <ol>
  <li>Fetch an array of <code>games</code> from an API. </li>
  <li>Iterate over <code>games</code> N times:
  
  <ul>
  <li>(async / concurrent)
  
  <ol>
  <li>Make an individual HTTP request for every game in order to get its
  details.</li>
  <li>Store the details of it in a <code>gamesWithDetails</code> array.</li>
  </ol></li>
  </ul></li>
  <li>Done. I have my array <code>gamesWithDetails</code>.</li>
  </ol>
  
  <p>I cannot fetch the details of all the games with a single request, I have to hit the API endpoint every time per game. So I want to execute these requests asynchronously from each other.</p>
  
  <p>This is a <strong>working example in JavaScript</strong> in case it's useful. However I'd like to make it work for Spring Boot.</p>
  
  <pre><code>axios.get(`https://la2.api.riotgames.com/lol/match/v4/matchlists/by-account/${data.accountId}`, {
    headers: { "X-Riot-Token": "asdasdasdasdadasdasdasd"}
  })
    .then(resp =&gt; {
      const promises = [];
  
      for ( match of resp.data.matches ) {
        promises.push(
          axios.get(`https://la2.api.riotgames.com/lol/match/v4/matches/${match.gameId}`, {
            headers: { "X-Riot-Token": "asdasdasdasdasdasdasdasd"}
          })
        )
      }
  
      Promise.all(promises)
        .then(matchesDetails =&gt; {
          matchesDetails.forEach(({ data }) =&gt; console.log(data.gameId));
        });
  
    })
  </code></pre>