Java – the cron expression of the spring scheduler – runs only once a year
•
Java
I like spring service
@Scheduled( cron="0 0 7 * * SUN") public void doSomething() { // do something }
I know you can't have the seventh value reserved for a specified year Using the expression, I can tell spring to run once a year at a specific time, for example, at 6 a.m. on December 25, 2020?
thank you
Solution
Yes, you can Just looked at the answer to this In short, you can use the following formats:
0 0 6 6 9 ? 2010 | | | | | | | | | | | | | +- 2010 only. | | | | | +----- any day of the week. | | | | +------- 9th month (September). | | | +--------- 6th day of the month. | | +----------- 6th hour of the day. | +------------- Top of the hour (minutes = 0). +--------------- Top of the minute (seconds = 0).
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码