对比新文件 |
| | |
| | | package com.mzl.flower.config; |
| | | |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | | import org.springframework.scheduling.annotation.EnableScheduling; |
| | | import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler; |
| | | |
| | | @Configuration |
| | | @EnableScheduling |
| | | public class SchedulerConfig { |
| | | |
| | | @Bean |
| | | public ThreadPoolTaskScheduler taskScheduler() { |
| | | ThreadPoolTaskScheduler scheduler = new ThreadPoolTaskScheduler(); |
| | | scheduler.setPoolSize(10); // 设置线程池大小 |
| | | scheduler.setThreadNamePrefix("hmy-scheduler-"); // 设置线程名前缀 |
| | | scheduler.initialize(); // 初始化线程池 |
| | | return scheduler; |
| | | } |
| | | } |