Add ThreadPoolTaskExecutorBuilder and deprecate TaskExecutorBuilder

Closes gh-36637
This commit is contained in:
Moritz Halbritter
2023-07-31 09:21:43 +02:00
parent 5c845c7ddc
commit 32c91af440
10 changed files with 741 additions and 42 deletions

View File

@@ -16,7 +16,7 @@ If you have defined a custom `Executor` in the context, both regular task execut
However, the Spring MVC and Spring WebFlux support will only use it if it is an `AsyncTaskExecutor` implementation (named `applicationTaskExecutor`).
Depending on your target arrangement, you could change your `Executor` into an `AsyncTaskExecutor` or define both an `AsyncTaskExecutor` 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.
The auto-configured `ThreadPoolTaskExecutorBuilder` allows you to easily create instances that reproduce what the auto-configuration does by default.
====
When a `ThreadPoolTaskExecutor` is auto-configured, the thread pool uses 8 core threads that can grow and shrink according to the load.
@@ -49,4 +49,4 @@ The thread pool uses one thread by default and its settings can be fine-tuned us
size: 2
----
Both a `TaskExecutorBuilder` bean and a `TaskSchedulerBuilder` bean are made available in the context if a custom executor or scheduler needs to be created.
Both a `ThreadPoolTaskExecutorBuilder` bean and a `TaskSchedulerBuilder` bean are made available in the context if a custom executor or scheduler needs to be created.