Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
441 views
in Technique[技术] by (71.8m points)

spring boot - Run cron jobs dynamically in java

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?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...