title: How to get spring-boot @Async to work with Java 8
body: <p>I am trying to call a method asynchronously. But somehow it doesn't work. Could someone please help me resolve this issue?</p>
  
  <p>My main entry point:</p>
  
  <pre><code>@SpringBootApplication
  @EnableAsync
  public class DemoApplication {
  
      public static void main(String[] args) {
          SpringApplication.run(DemoApplication.class, args);
          AsyncService asyncService = new AsyncService();
          asyncService.asyncMethod();
          asyncService.asyncMethod();
      }
  
  }
  </code></pre>
  
  <p>Async Service:</p>
  
  <pre><code>@Component
  public class AsyncService {
  
      @Async
      public void asyncMethod(){
  
          log.info("starting...");
          try {
              TimeUnit.SECONDS.sleep(2);
          } catch (InterruptedException e) {
              e.printStackTrace();
          }
          log.info("ending...");
      }
  }
  </code></pre>
  
  <p>And finally, in log I am expecting:</p>
  
  <ol>
  <li>starting...</li>
  <li>starting...</li>
  <li>ending...</li>
  <li>ending...</li>
  </ol>
  
  <p>but this is what I get:</p>
  
  <pre><code>  .   ____          _            __ _ _
   /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
  ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
   \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
    '  |____| .__|_| |_|_| |_\__, | / / / /
   =========|_|==============|___/=/_/_/_/
   :: Spring Boot ::        (v2.1.2.RELEASE)
  
  2019-02-13 17:52:41.548  INFO 85734 --- [           main] com.example.demo.DemoApplication         : Starting DemoApplication on mntbden00122972 with PID 85734 (/Users/h3560/demo/target/classes started by h3560 in /Users/h3560/demo)
  2019-02-13 17:52:41.550  INFO 85734 --- [           main] com.example.demo.DemoApplication         : No active profile set, falling back to default profiles: default
  2019-02-13 17:52:42.084  INFO 85734 --- [           main] com.example.demo.DemoApplication         : Started DemoApplication in 0.76 seconds (JVM running for 1.329)
  2019-02-13 17:52:42.086  INFO 85734 --- [           main] com.example.demo.services.AsyncService   : starting...
  2019-02-13 17:52:44.088  INFO 85734 --- [           main] com.example.demo.services.AsyncService   : ending...
  2019-02-13 17:52:44.089  INFO 85734 --- [           main] com.example.demo.services.AsyncService   : starting...
  2019-02-13 17:52:46.091  INFO 85734 --- [           main] com.example.demo.services.AsyncService   : ending...
  </code></pre>