I've got an Async method which is scheduled to run once a day:
@Component
public class MyClass {
//myCronProperty set to "0 25 20 * * *" in application.properties
@Scheduled(cron="{myCronProperty}")
@Async
@Override
public void doDailyTask() {
//Do work here
}
}
Is there a way of triggering doDailyTask()
for testing purposes when the application is already running, perhaps by doing something clever with Groovy and reflection?
I figure I can always tweak the cron property to 1 minute in the future in my application.properties
file, and then restart the application - but just wondered if there was a smarter method?