My Spring service loooks like
@Scheduled( cron="0 0 7 * * SUN")
public void doSomething() {
// do something
}
I understand you can't have the 7th value which is reserved for specifying a year. using a expression can I tell spring to just run once a year at a particular time say 25th Dec 6 am in 2020 ?
Thanks
Yes, you can. Just have a look at this answer. In short, you can use the format:
0 0 6 6 9 ?
| | | | | |
| | | | | |
| | | | | +----- 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).