Quartz 2.x文档说
因此,cron表达式可以像这样简单:* * * *?*或更复杂,例如:0/5 14,18,3-39,52 *?1月,3月,9月MON-FRI 2002-2010年
但是如果我尝试
System.out.println(org.quartz.CronExpression.isValidExpression("* * * * ? * *"));
它说
false
为什么?
isValidExpression的Javadoc是http://quartz-scheduler.org/api/2.2.1/org/quartz/CronExpression.html
附言 这个问题不是验证cron表达式在Java中有效的重复
链接的JavaDoc提到了cron表达式的这种结构:
Field Name Allowed Values Allowed Special Characters
Seconds 0-59 , - * /
Minutes 0-59 , - * /
Hours 0-23 , - * /
Day-of-month 1-31 , - * ? / L W
Month 1-12 or JAN-DEC , - * /
Day-of-Week 1-7 or SUN-SAT , - * ? / L #
Year (Optional) empty, 1970-2199 , - * /
你的cron表达式是"* * * * ? * *"
用?
在了第五位Month
。正如你所看到的,这个人物是不是不允许存在。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句