mirror of
https://gitee.com/yudaocode/yudao-boot-mini.git
synced 2026-03-22 05:27:15 +08:00
!1510 feat(BPM): AsyncTaskExecutor 如果不创建,会导致项目启动时,Flowable 报错的问题
Merge pull request !1510 from puhui999/master-jdk17
This commit is contained in:
@@ -11,9 +11,12 @@ import org.flowable.common.engine.api.delegate.event.FlowableEventListener;
|
|||||||
import org.flowable.spring.SpringProcessEngineConfiguration;
|
import org.flowable.spring.SpringProcessEngineConfiguration;
|
||||||
import org.flowable.spring.boot.EngineConfigurationConfigurer;
|
import org.flowable.spring.boot.EngineConfigurationConfigurer;
|
||||||
import org.springframework.beans.factory.ObjectProvider;
|
import org.springframework.beans.factory.ObjectProvider;
|
||||||
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||||
import org.springframework.context.ApplicationEventPublisher;
|
import org.springframework.context.ApplicationEventPublisher;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.core.task.AsyncTaskExecutor;
|
||||||
|
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -25,6 +28,26 @@ import java.util.List;
|
|||||||
@Configuration(proxyBeanMethods = false)
|
@Configuration(proxyBeanMethods = false)
|
||||||
public class BpmFlowableConfiguration {
|
public class BpmFlowableConfiguration {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 参考 {@link org.flowable.spring.boot.FlowableJobConfiguration} 类,创建对应的 AsyncListenableTaskExecutor Bean
|
||||||
|
* <p>
|
||||||
|
* 如果不创建,会导致项目启动时,Flowable 报错的问题
|
||||||
|
*/
|
||||||
|
@Bean(name = "applicationTaskExecutor")
|
||||||
|
@ConditionalOnMissingBean(name = "applicationTaskExecutor")
|
||||||
|
public AsyncTaskExecutor taskExecutor() {
|
||||||
|
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
|
||||||
|
executor.setCorePoolSize(8);
|
||||||
|
executor.setMaxPoolSize(8);
|
||||||
|
executor.setQueueCapacity(100);
|
||||||
|
executor.setThreadNamePrefix("flowable-task-Executor-");
|
||||||
|
executor.setAwaitTerminationSeconds(30);
|
||||||
|
executor.setWaitForTasksToCompleteOnShutdown(true);
|
||||||
|
executor.setAllowCoreThreadTimeOut(true);
|
||||||
|
executor.initialize();
|
||||||
|
return executor;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* BPM 模块的 ProcessEngineConfigurationConfigurer 实现类:
|
* BPM 模块的 ProcessEngineConfigurationConfigurer 实现类:
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user