I want to run cron jobs dynamically.
Instead of putting a direct @Scheduled annotation like @Scheduled(cron = "0 0/30 3 * * *")
on the main function, I want to take cron expression in input and then schedule job according to the input given.
I have tried to use CronExpression
, But it's not giving correct results.
Even for cronExpression = "0 0/30 1 * * *"
, It's returning that cron expression is not valid.
Error that I am getting while using cronExpression is
Exception in thread "main" java.text.ParseException: Support for specifying both a day-of-week AND a day-of-month parameter is not implemented.
Is there any way to do this?