title: Non blocking REST with Spring Boot and Java 8
body: <p>I need assistance.</p>
  <p>An issue with one of my endpoints timing out is causing me distress.
  I did some performance tweaking with SQL and other REST services I am using but it only helps a little bit.
  A nice solution for this problem, I thought, would be to use some of the Async capabilities of Spring Boot and Java 8 and perform some sort of &quot;Fire and forget&quot; action.</p>
  <p>I tried something like that, but it is no good, the &quot;Time to rock!&quot; message gets printed out all right but it seems that getLyrics() method is not invoked at all!</p>
  <pre><code>    //MyController.java
      @GET
      @Path(&quot;na/na/na&quot;)
      @Produces({&quot;application/json&quot;})
      public Response getLyrics() {
  
          final String lyrics = delegate.getLyrics();
          return Response.ok().entity(lyrics.isEmpty()).build();
      }
  
      //MyDelegate.java
      @Async(&quot;threadPoolTaskExecutor&quot;)
      public Future&lt;Boolean&gt; getLyrics() {
  
          LOG.info(&quot;Time to rock!&quot;);
          final boolean result = lyricsService.getLyrics();
          return new AsyncResult&lt;Boolean&gt;(result);
      }
  
      //MyAsyncConfig.java
      @Configuration
      @EnableAsync
      public class MyAsyncConfig {
  
          @Bean(name = &quot;threadPoolTaskExecutor&quot;)
          public Executor threadPoolTaskExecutor() {
              return new ThreadPoolTaskExecutor();
          }
      }
  </code></pre>
  <p>So, lyricsService.getLyrics() (that is not being called for some reason) does all the work, calls other services, fetches stuff from the SQL database, and performs calls against some other REST endpoints. All of this takes time and sometimes*  causes a timeout. I would like it to process in peace, and if possible, return some sort of response when possible.</p>
  <p>I tried several variations of this solution as it seems to be close to what I need, but can't seem to get why it is not working for me.</p>
  <p>*often</p>