转自:https://blog.csdn.net/kongling16688/article/details/45918833
1.initialDelay :初次执行任务之前需要等待的时间
@Scheduled(initialDelay =5000) public void doSomething() { }
2.fixedDelay:每次执行任务之后间隔多久再次执行该任务。
@Scheduled(fixedDelay=5000) public void doSomething() { // something that should execute periodically }
3.fixedRate:执行频率,每隔多少时间就启动任务,不管该任务是否启动完成
@Scheduled(fixedRate=5000) public void doSomething() { }
4.cron=“”设置时分秒等具体的定时,网上很很多相关列子。
例如:转:http://blog.csdn.net/kkdelta/article/details/7238581
扫描二维码关注公众号,回复:
3626697 查看本文章
@Scheduled(cron="*/5 * * * * MON-FRI") public void doSomething() { // something that should execute on weekdays only }
下面是个定时的学习的一个案例,感觉蛮好,给大家分享下 :
Spring使用之:Quartz定时任务为什么会被阻塞:http://fhqllt.iteye.com/blog/434943
--------------------- 本文来自 空灵16688 的CSDN 博客 ,全文地址请点击:https://blog.csdn.net/kongling16688/article/details/45918833?utm_source=copy