- 博客(3)
- 收藏
- 关注
原创 springboot 定时器使用方法之并行
实现 SchedulingConfigurer 接口,重写 configureTasks 方法 线程池的bean名称需要设置为 taskScheduler@Configuration@EnableScheduling//当定时任务很多的时候,为了提高任务执行效率,可以采用并行方式执行定时任务,任务之间互不影响,//只要实现SchedulingConfigurer接口就可以public class ScheduleConfig implements SchedulingConfigurer {
2021-08-17 16:40:35
468
原创 springboot 定时器使用方法之串行
方法一在启动类上面标注上@EnableScheduling注解,给要定时执行的方法上添加注解@Scheduled(cron = "0 0 0 * * * ")@SpringBootApplication@EnableSchedulingpublic class BigdataAttendanceApplication { public static void main(String[] args) { SpringApplication.run(BigdataAttendanceApp
2021-08-17 15:26:15
425
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人