首页 > 编程语言 > 详细

Spring Boot参考教程(十)定时任务

时间:2017-10-11 22:15:41      阅读:274      评论:0      收藏:0      [点我收藏+]

8. 定时任务

 

关于定时任务,考虑到应用的集群部署,一般会使用分布式的定时任务,后期章节会讲述,

本章只演示Spring Boot提供的定时任务使用方式。

技术分享

 

加入注解@EnableScheduling开启定时任务。

 

@Scheduled(initialDelay= 100, fixedRate = 5000)表示延迟一秒执行后没5秒执行一次。

@Scheduled(cron= "0/5 * * * * ?")可直接使用Corn表达式。

 

 

 

 

 

<实例代码>

Github:https://github.com/chunyuding/SpringBoot-Demo

https://github.com/chunyuding/SpringBoot-Demo.git

码云:https://gitee.com/dingchunyu/SpringBoot-Demo

      https://gitee.com/dingchunyu/SpringBoot-Demo.git

 

<推荐书籍>

 百度云:http://pan.baidu.com/s/1qYA0Nxi

Spring Boot参考教程(十)定时任务

原文:http://www.cnblogs.com/dingchunyu/p/7653073.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!