1、在启动类 加入注解 @EnableScheduling
2、建立task包
3、在task类上加@Component
4、在task方法上加入 @Scheduled(cron = "${job.schedule}")
5、在配置文件上
job:
schedule: 0 0/5 * * * ?
总结定时任务功能
最新推荐文章于 2023-06-20 10:10:08 发布
1、在启动类 加入注解 @EnableScheduling
2、建立task包
3、在task类上加@Component
4、在task方法上加入 @Scheduled(cron = "${job.schedule}")
5、在配置文件上
job:
schedule: 0 0/5 * * * ?