语法:秒 分 时 日 月 周 年 (spring 不支持年,所以可以不写)
http://www.quartz-scheduler.org/documentation/quartz-2.3.0/tutorials/crontrigger.html
A cron expression is a string comprised of 6 or 7 fields separated by white space. Fields can contain any of the allowed values, along withvarious combinations of the allowed special characters for that field. The fields are as follows:FieldNameMandatoryAllowedValuesAllowedSpecialCharactersSeconds YES 0-59,-*/Minutes YES 0-59,-*/Hours YES 0-23,-*/Day of month YES 1-31,-*?/LWMonth YES 1-12 or JAN-DEC ,-*/Day of week YES 1-7 or SUN-SAT ,-*?/L #
1:周末 7:周一
YearNO empty,1970-2099,-*/
特殊字符:,:枚举;(cron="7,9,23****?"):任意时刻的7,9,23秒启动这个任务;-:范围:(cron="7-20****?""):任意时刻的7-20秒之间,每秒启动一次
*:任意;
指定位置的任意时刻都可以
/:步长;(cron="7/5****?"):第7秒启动,每5秒一次;(cron="*/5****?"):任意秒启动,每5秒一次;?:(出现在日和周几的位置):为了防止日和周冲突,在周和日上如果要写通配符使用?(cron="***1*?"):每月的1号,而且必须是周二然后启动这个任务;L:(出现在日和周的位置)”,
last:最后一个
(cron="***?*3L"):每月的最后一个周二(1:周末 2:周一 3:周二 4:周三 5:周四 6:周五 7:周六)
W:WorkDay:工作日
(cron="***W*?"):每个月的工作日触发
(cron="***LW*?"):每个月的最后一个工作日触发
#:第几个
(cron="***?*5#2"):每个月的 第2个周4
3.在线Cron表达式生成器
2.cron示例
**Expression****Meaning**0012**?Fire at 12pm (noon) every day
01510?**Fire at 10:15am every day
01510**?Fire at 10:15am every day
01510**?*Fire at 10:15am every day
01510**?2005Fire at 10:15am every day during the year 20050*14**?Fire every minute starting at 2pm and ending at 2:59pm, every day
00/514**?Fire every 5 minutes starting at 2pm and ending at 2:55pm, every day
00/514,18**?Fire every 5 minutes starting at 2pm and ending at 2:55pm, AND fire every 5 minutes starting at 6pm and ending at 6:55pm, every day
00-514**?Fire every minute starting at 2pm and ending at 2:05pm, every day
010,4414?3 WED Fire at 2:10pm and at 2:44pm every Wednesday in the month of March.01510?* MON-FRI Fire at 10:15am every Monday,Tuesday,Wednesday,Thursday and Friday0151015*?Fire at 10:15am on the 15th day of every month
01510L*?Fire at 10:15am on the last day of every month
01510L-2*?Fire at 10:15am on the 2nd-to-last last day of every month
01510?*6LFire at 10:15am on the last Friday of every month
01510?*6LFire at 10:15am on the last Friday of every month
01510?*6L2002-2005Fire at 10:15am on every last friday of every month during the years 2002,2003,2004 and 200501510?*6#3Fire at 10:15am on the third Friday of every month
00121/5*?Fire at 12pm (noon) every 5 days every month, starting on the first day of the month.011111111?Fire every November11th at 11:11am.