We have written a simple application in spring boot that triggers a cron job. We are able to launch it successfully. Below is pice of code.
CronTask task = new CronTask(new Runnable() {
@Override
public void run() {
System.out.println("Job running ...")
}
}, cronExpression);
taskRegistrar.addCronTask(task);
taskRegistrar.afterPropertiesSet();
Now how to unregister/kill/destroy/remove the task started by me.
I can get the corn task back from the registry using
this.taskRegistrar.getCronTaskList();
But don't see a method in the registry to unregister a task nor any method in task to destroy it.