diff --git a/src/main/java/com/spring/config/ScheduleConfig.java b/src/main/java/com/spring/config/ScheduleConfig.java new file mode 100644 index 00000000..67bbd98a --- /dev/null +++ b/src/main/java/com/spring/config/ScheduleConfig.java @@ -0,0 +1,23 @@ +package com.spring.config; + +import org.springframework.beans.factory.annotation.Value; +import org.springframework.scheduling.annotation.SchedulingConfigurer; +import org.springframework.scheduling.config.ScheduledTaskRegistrar; + +import java.util.concurrent.Executors; + +/** + * @author LR + * @version 1.0 + * @description: 定时任务多线程控制器 + * @date 2026-6-12 14:50 + */ +public class ScheduleConfig implements SchedulingConfigurer { + + @Value("${task.pool.schedulerSize}") + private int schedulerSize; + @Override + public void configureTasks(ScheduledTaskRegistrar scheduledTaskRegistrar) { + scheduledTaskRegistrar.setScheduler(Executors.newScheduledThreadPool(schedulerSize)); + } +} diff --git a/src/main/resources/application-dev.yml b/src/main/resources/application-dev.yml index b9f890ca..bb5f0e27 100644 --- a/src/main/resources/application-dev.yml +++ b/src/main/resources/application-dev.yml @@ -102,9 +102,11 @@ task: syncDataToPLM: 0 0 0 29 2 ? # 每4年执行 syncLocationToPLM: 0 0 0 29 2 ? # 每4年执行 sync_part_catalog_to_plm: 0 0 0 29 2 ? # 每1分钟执行 - syncInventoryPartToPlm: 0 0 0 29 2 ? # 每4年执行 + syncInventoryPartToPlm: 0 */10 * * * ? # 每10分钟执行 refreshLdapAccountToRedis: 0 0 0 * * ? # flag: false + pool: + schedulerSize: 10 # 单点登录 login-token-url: 'http://192.168.1.160:8881/#/login-token'