I have a requirement to run a batch job at a fixed interval and have the ability to change the time of this batch job at runtime. For this I came across @Scheduled
annotation provided under Spring framework. But I’m not sure how I’d change the value of fixedDelay at runtime. I did some googling around but didn’t find anything useful.
Advertisement
Answer
You can use a Trigger
to dynamically set the next execution time.
See my answer to Scheduling a job with Spring programmatically for details.