I have method annotaded with @Scheduled("cron = 0 3 * * * *") but it runs not in 3am each day but each hour. What`s wrong?

有帮助吗?

解决方案

There are totally 6 fields in cron expression in this order - second, minute, hour, day of month, month, day(s) of week. You have configured only the second and minute.so, it will every hour in the third minute.

Cron should be 0 0 3 * * *

Now, it will run 3:00:00 AM everyday in the morning

其他提示

I believe you need 0 0 3 ... in your expression instead of 0 3 ..

EDIT Specifically 0 0 3 1/1 * ? *

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top