在春季启动范围小时内配置时间表

时间:2019-05-08 07:15:07

标签: spring schedule

大家好

我想在上午8点至晚上10点之间的每一分钟安排自己的时间表。 我尝试了该代码。

@Scheduled(cron = "0 */1 8-22 * * MON-FRI")

但这不起作用!我很困惑。救救我!

1 个答案:

答案 0 :(得分:0)

you can find out crontab information StackOverflow link

这些是cron表达式的有效格式:

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 6,19 * * * = 6:00 AM and 7:00 PM every day.
0 0/30 8-10 * * * = 8:00, 8:30, 9:00, 9:30, 10:00 and 10:30 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

模式是:

second, minute, hour, day, month, weekday