From 11b6faf6f8e4a9fa9267b5bde91c886f654efd95 Mon Sep 17 00:00:00 2001 From: PIGCLOUD Date: Wed, 11 Feb 2026 21:25:50 +0800 Subject: [PATCH] =?UTF-8?q?feat(WebCommonConfiguration):=20=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E5=BC=82=E6=AD=A5=E4=BB=BB=E5=8A=A1=E6=89=A7=E8=A1=8C?= =?UTF-8?q?=E5=99=A8=E9=85=8D=E7=BD=AE=EF=BC=8C=E6=94=AF=E6=8C=81Flowable?= =?UTF-8?q?=E5=BC=82=E6=AD=A5=E4=BB=BB=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pigx/common/core/config/WebCommonConfiguration.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/pigx-common/pigx-common-core/src/main/java/com/pig4cloud/pigx/common/core/config/WebCommonConfiguration.java b/pigx-common/pigx-common-core/src/main/java/com/pig4cloud/pigx/common/core/config/WebCommonConfiguration.java index 2f11ed99e..8f1d3a5ca 100644 --- a/pigx-common/pigx-common-core/src/main/java/com/pig4cloud/pigx/common/core/config/WebCommonConfiguration.java +++ b/pigx-common/pigx-common-core/src/main/java/com/pig4cloud/pigx/common/core/config/WebCommonConfiguration.java @@ -22,6 +22,7 @@ import org.springframework.boot.autoconfigure.task.TaskExecutionProperties; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Primary; import org.springframework.core.task.AsyncTaskExecutor; import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; import org.springframework.web.client.RestTemplate; @@ -48,15 +49,17 @@ public class WebCommonConfiguration implements WebMvcConfigurer { } /** - * 异步任务执行器,用于处理Spring MVC异步请求 + * 异步任务执行器,用于处理Spring MVC异步请求和Flowable异步任务 *

* 配置项通过 spring.task.execution.* 进行配置 + * Bean名称为 applicationTaskExecutor,符合Spring Boot默认命名约定 *

* * @return AsyncTaskExecutor实例 */ @Bean - public AsyncTaskExecutor applicationAsyncTaskExecutor() { + @Primary + public AsyncTaskExecutor applicationTaskExecutor() { TaskExecutionProperties.Pool pool = taskExecutionProperties.getPool(); ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor(); executor.setCorePoolSize(pool.getCoreSize()); @@ -73,7 +76,7 @@ public class WebCommonConfiguration implements WebMvcConfigurer { @Override public void configureAsyncSupport(AsyncSupportConfigurer configurer) { - configurer.setTaskExecutor(applicationAsyncTaskExecutor()); + configurer.setTaskExecutor(applicationTaskExecutor()); } /**