Simplify TaskExecutionAutoConfiguration

pull/36682/head
Moritz Halbritter 1 year ago
parent 4ba7463d75
commit 19859a9023

@ -38,8 +38,7 @@ import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
@Import({ TaskExecutorConfigurations.ThreadPoolTaskExecutorBuilderConfiguration.class,
TaskExecutorConfigurations.TaskExecutorBuilderConfiguration.class,
TaskExecutorConfigurations.SimpleAsyncTaskExecutorBuilderConfiguration.class,
TaskExecutorConfigurations.VirtualThreadTaskExecutorConfiguration.class,
TaskExecutorConfigurations.ThreadPoolTaskExecutorConfiguration.class })
TaskExecutorConfigurations.TaskExecutorConfiguration.class })
public class TaskExecutionAutoConfiguration {
/**

@ -47,27 +47,22 @@ import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
*/
class TaskExecutorConfigurations {
@ConditionalOnThreading(Threading.VIRTUAL)
@Configuration(proxyBeanMethods = false)
@ConditionalOnMissingBean(Executor.class)
static class VirtualThreadTaskExecutorConfiguration {
@SuppressWarnings("removal")
static class TaskExecutorConfiguration {
@Bean(name = { TaskExecutionAutoConfiguration.APPLICATION_TASK_EXECUTOR_BEAN_NAME,
AsyncAnnotationBeanPostProcessor.DEFAULT_TASK_EXECUTOR_BEAN_NAME })
SimpleAsyncTaskExecutor applicationTaskExecutor(SimpleAsyncTaskExecutorBuilder builder) {
@ConditionalOnThreading(Threading.VIRTUAL)
SimpleAsyncTaskExecutor applicationTaskExecutorVirtualThreads(SimpleAsyncTaskExecutorBuilder builder) {
return builder.build();
}
}
@Configuration(proxyBeanMethods = false)
@ConditionalOnMissingBean(Executor.class)
@SuppressWarnings("removal")
static class ThreadPoolTaskExecutorConfiguration {
@Lazy
@Bean(name = { TaskExecutionAutoConfiguration.APPLICATION_TASK_EXECUTOR_BEAN_NAME,
AsyncAnnotationBeanPostProcessor.DEFAULT_TASK_EXECUTOR_BEAN_NAME })
@ConditionalOnThreading(Threading.PLATFORM)
ThreadPoolTaskExecutor applicationTaskExecutor(TaskExecutorBuilder taskExecutorBuilder,
ObjectProvider<ThreadPoolTaskExecutorBuilder> threadPoolTaskExecutorBuilderProvider) {
ThreadPoolTaskExecutorBuilder threadPoolTaskExecutorBuilder = threadPoolTaskExecutorBuilderProvider

Loading…
Cancel
Save