package com.test.common.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;

/**
 * @author liangdaliang
 * @Description：自定义定时任务配置
 * @date 2025-02-24 10:27
 */
@Configuration
public class SchedulerConfig {

    @Bean
    public ThreadPoolTaskScheduler taskScheduler() {
        ThreadPoolTaskScheduler scheduler = new ThreadPoolTaskScheduler();
        scheduler.setPoolSize(60); // 设置线程池大小
        scheduler.setThreadNamePrefix("TestTaskScheduler-");
        return scheduler;
    }
}
