package com.newfiber.config; import org.springframework.context.annotation.Configuration; import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.scheduling.annotation.SchedulingConfigurer; import org.springframework.scheduling.config.ScheduledTaskRegistrar; import java.util.concurrent.Executors; /** * @Author: huhy * @Date:2020/1/6 9:34 * 项目名称:pump_dock_wuhan * @description: 异步任务 */ @Configuration @EnableScheduling // 启用定时任务 public class ScheduleConfig implements SchedulingConfigurer { @Override public void configureTasks(ScheduledTaskRegistrar taskRegistrar) { taskRegistrar.setScheduler(Executors.newScheduledThreadPool(6)); } }