title: Rest Controller isn't asynchronous
body: <p>I am trying to create asynchronous REST API. Every call starts service method which takes 2 seconds to finish. I would like to make 20 calls at the same time and start all this methods on different threads so my controller would not be blocked and I could get all responses in about ~ 2 sec.</p>
  
  <p>I tried adding @Asnyc annotation to both Controller, and service, but they were giving me empty response, after adding CompletableFuture as response I am getting proper response but now it is not async and I need to wait about 40 sec for all responses.</p>
  
  <pre><code>@RestController
  public class BasicController{
  
  
      @Autowired
      private BasicService basicService;
  
      @Async("asyncExecutor")
      @GetMapping("/basic/{owner}/{path}")
      public CompletableFuture&lt;InfoDTO&gt;getGitApiInfo(@PathVariable("owner") String owner,
                                                     @PathVariable("path") String path) throws InterruptedException {
          return basicService.getRepositoryInfo(owner, path);
      }
  
  }
  
  
  
  @Service
  public class BasicService{
  
  
      @Async("asyncExecutor")
      public CompletableFuture&lt;InfoDTO&gt; getRepositoryInfo(String owner, String repoName) throws InterruptedException {
          Thread.sleep(2000);
          return CompletableFuture.completedFuture(new InfoDTO(owner, repoName);
      }
  
  }
  
  
  @EnableAsync
  @Configuration
  public class ServicesConfig {
  
      @Bean(name = "asyncExecutor")
      public Executor asyncExecutor() {
          ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
          executor.setCorePoolSize(8);
          executor.setMaxPoolSize(20);
          executor.setQueueCapacity(500);
          executor.setWaitForTasksToCompleteOnShutdown(true);
          executor.setThreadNamePrefix("Async-");
          executor.initialize();
          return executor;
      }
  }
  
  </code></pre>
  
  <p>I would like to get 20 responses from this controller in about 2-3 sec using postman runner.</p>