Skip to content

Commit d499277

Browse files
committed
Improve TaskExecution documentation with custom Executor and Spring MVC
Closes gh-15447
1 parent 6ad01a6 commit d499277

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

spring-boot-project/spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6359,11 +6359,24 @@ in a similar manner, as shown in the following example:
63596359

63606360
[[boot-features-task-execution-scheduling]]
63616361
== Task Execution and Scheduling
6362-
In the absence of a `TaskExecutor` bean in the context, Spring Boot auto-configures a
6362+
In the absence of an `Executor` bean in the context, Spring Boot auto-configures a
63636363
`ThreadPoolTaskExecutor` with sensible defaults that can be automatically associated to
63646364
asynchronous task execution (`@EnableAsync`) and Spring MVC asynchronous request
63656365
processing.
63666366

6367+
[TIP]
6368+
====
6369+
If you have defined a custom `Executor` in the context, regular task execution (i.e.
6370+
`@EnableAsync`) will use it transparently but the Spring MVC support will not be
6371+
configured as it requires an `AsyncTaskExecutor` implementation (named
6372+
`applicationTaskExecutor`). Depending on your target arrangement, you could change your
6373+
`Executor` into a `ThreadPoolTaskExecutor` or define both a `ThreadPoolTaskExecutor` and
6374+
an `AsyncConfigurer` wrapping your custom `Executor`.
6375+
6376+
The auto-configured `TaskExecutorBuilder` allows you to easily create instances that
6377+
reproduces what the auto-configuration does by default.
6378+
====
6379+
63676380
The thread pool uses 8 core threads that can grow and shrink according to the load. Those
63686381
default settings can be fine-tuned using the `spring.task.execution` namespace as shown in
63696382
the following example:

0 commit comments

Comments
 (0)