博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
spring整合任务调度
阅读量:7250 次
发布时间:2019-06-29

本文共 1976 字,大约阅读时间需要 6 分钟。

hot3.png

需要的包

org.springframework
spring-context-support
${spring.version}
org.quartz-scheduler
quartz
2.2.1
org.quartz-scheduler
quartz-jobs
2.2.1

spring中配置bean

0 */2 * * * ?

Cron Expressions 轮询表达式(我翻译的,个人理解)

Cron-Expressions are used to configure instances of CronTrigger. Cron-Expressions are strings that are actually made up of seven sub-expressions, that describe individual details of the schedule. These sub-expression are separated with white-space, and represent

  1. Seconds
  2. Minutes
  3. Hours
  4. Day-of-Month
  5. Month
  6. Day-of-Week
  7. Year (optional field)

轮询表达式用来初始化调度器,轮询表达式是一个由七个空格分开的子表达式组成的字符串。它描述了调度详情。这些子表达式由空格分开,分表表示 “秒 分 小时 每个月份中哪一天 月份 每周的哪一天 年(可选项)”

Example Cron Expressions 轮询表达式举例

CronTrigger Example 1 - an expression to create a trigger that simply fires every 5 minutes

“0 0/5 * * * ?”     每5分钟执行一次

CronTrigger Example 2 - an expression to create a trigger that fires every 5 minutes, at 10 seconds after the minute (i.e. 10:00:10 am, 10:05:10 am, etc.).

“10 0/5 * * * ?”   每五分钟的第十秒执行

CronTrigger Example 3 - an expression to create a trigger that fires at 10:30, 11:30, 12:30, and 13:30, on every Wednesday and Friday.

“0 30 10-13 ? * WED,FRI”  每天10点到13点种,每半个小时执行一次。

CronTrigger Example 4 - an expression to create a trigger that fires every half hour between the hours of 8 am and 10 am on the 5th and 20th of every month. Note that the trigger will NOT fire at 10:00 am, just at 8:00, 8:30, 9:00 and 9:30

“0 0/30 8-9 5,20 * ?”   每个月的第5号和第20号,每天8点到9点,每半个小时执行一次【8:00,8:30,9:00,9:30】。(比较绕,静下心来好好看)

转载于:https://my.oschina.net/u/2494581/blog/806200

你可能感兴趣的文章
红帽集群套件RHCS四部曲(概念篇)
查看>>
TFS配置(二)
查看>>
GeoServer地图开发解决方案(五):基于Silverlight技术的地图客户端实现
查看>>
Android应用程序键盘(Keyboard)消息处理机制分析(3)
查看>>
Linux上连接Microsoft SQL Server 2005
查看>>
私有云管理-Windows Azure Pack
查看>>
Linux下文件和目录的颜色代表的含义
查看>>
Forefront Client Security服务器部署
查看>>
Crystal Reports中的字段
查看>>
一个例子探究jQuery的Ajax应用(二)
查看>>
PPT of "SharePoint 2007 网站性能优化"
查看>>
爪哇国新游记之三十四----Dom4j的XPath操作
查看>>
node17
查看>>
Java程序性能优化4
查看>>
第一次负责项目总结
查看>>
Azure Redis Cache (2) 创建和使用Azure Redis Cache
查看>>
python统计ES存储空间占用的代码
查看>>
成就连自己都惊讶的未来
查看>>
依赖倒置(DIP)与依赖注入(DI)
查看>>
mysql数据库授权
查看>>