Sometimes I want to have a task that runs 1M after the app starts as well as once a day at 1AM.

Right now, there doesn't seem to be an option using @Scheduled to do this.

A workaround is to annotate the method like this:

@Scheduled(cron = "...")
@Scheduled(initialDelayString = "PT1M", fixedDelay = Long.MAX_VALUE)
public void doSomething() {
}

It would be nice if @Scheduled had an attribute such as runOnce=true|false and/or maxRuns=integer to control how many times a scheduled job is allowed to run.

Comment From: snicoll

Thanks for the suggestion and sorry it took so long to process it.

This has been implemented recently, see #31211