Im trying to manage scheduled tasks using spring boot. I want to execute my job only one time at a particular date ( specified by the user ). Here is my Job :
@Component
public class JobScheduler{
@Autowired
JobController controller;
// Retrieving the Date entered by the user
controller.getDateForExecution(); // 2016/05/24 10:00 for example
@Scheduled(???)
public void performJob() throws Exception {
controller.doSomething();
}
There are multiple options for Scheduled annotation such as fixedDelay, fixedRate, initialDelay, cron ... but none of these can accept a Date. So, how can i execute my method at the specified Date dynamically ( ie depending on the Date insered ) ?
Ps : The method can be executed more than once if the user enter two or more Dates ..