I want to schedule cron at Runtime. I am fetching my cron list from database based on that list i want to schedule cron expression. Can some one help me out with this.
package com.app.schedule.schedular;
import org.quartz.SchedulerException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import com.app.schedule.controller.AlertController;
import com.fasterxml.jackson.core.JsonProcessingException;
@Configuration
@EnableScheduling
public class Schedular {
@Autowired AlertController alertController;
@Scheduled(cron = "0 23 17 * * ?")
public void scheduleTaskUsingCronExpression() throws JsonProcessingException, SchedulerException {
alertController.getAlertList();
}
}