Spring Boot Task Execution and Scheduling

If an Executor bean is not present in the context, Spring Boot auto-configures and adds a ThreadPoolTaskExecutor with sensible defaults. And it automatically associates to asynchronous task execution (@EnableAsync) and Spring MVC asynchronous request processing.

If you have defined a custom Executor in the context, regular task execution (that is @EnableAsync) will use it transparently but the Spring MVC support will not be configured as it requires an AsyncTaskExecutor implementation (named applicationTaskExecutor). Depending on your target arrangement, you could change your Executor into a ThreadPoolTaskExecutor or define both a ThreadPoolTaskExecutor and an AsyncConfigurer wrapping your custom Executor.

The auto-configured TaskExecutorBuilder allows you to easily create instances that reproduce what the auto-configuration does by default.

Comments

Popular posts from this blog

Hibernate Many to Many Relationship

Why Integral Calculus limit tending to infinity a sacrilege

Introduction