尝试:
@Scheduled(cron = "0 1 1 * * ?")
你可以在下面的Spring论坛中找到示例模式:
* "0 0 * * * *" = the top of every hour of every day.* "*/10 * * * * *" = every ten seconds.* "0 0 8-10 * * *" = 8, 9 and 10 o'clock of every day.* "0 0 8,10 * * *" = 8 and 10 o'clock of every day.* "0 0/30 8-10 * * *" = 8:00, 8:30, 9:00, 9:30 and 10 o'clock every day.* "0 0 9-17 * * MON-FRI" = on the hour nine-to-five weekdays* "0 0 0 25 12 ?" = every Christmas Day at midnight
Cron表达式由六个字段表示:
second, minute, hour, day of month, month, day(s) of week
(*)意味着匹配任何
*/X表示“每个X”
?(“无特定值”)-在需要在允许使用字符的两个字段之一中指定某些内容而在另一个不允许使用的字段中指定内容时很有用。例如,如果我希望触发器在每月的某个特定日期(例如10号)触发,但是我不在乎一周中的哪一天,我会在当天输入“ 10”,月字段和“?” 在“星期几”字段中。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)