Spring Boot ASync + AutoWired Executor vs manual Executor + Future/Callable?

Viewed 2315

Is there a drawback to creating and managing your own ExecutorService vs using Spring Boot's @Async on a method with an @Bean method to create an Executor?

To me, doing it manually seems much simpler. I simply create my ExecutorService and a method that uses it to schedule a task/Callable.

I Spring Boot I would need:

  • Decorate the method with @Async
  • Decorate my Configuration class with @Configuration, @EnableAsync
  • Add an @Bean to create an Executor

Are there potential issues to doing it manually? Will Spring possibly kill the thread? Are there some other benefits to using the Spring Async pattern?

1 Answers
Related