开发者

Dynamically scheduling quartz cron job in spring?

开发者 https://www.devze.com 2023-03-30 08:06 出处:网络
Currently I\'m running Quartz scheduler example in this link http://www.mkyong.com/spring/spring-quartz-scheduler-example/

Currently I'm running Quartz scheduler example in this link http://www.mkyong.com/spring/spring-quartz-scheduler-example/

My question is this How can I add 开发者_JAVA百科a dynamic time in CronTrigger bean, instead of hard-coded time in here :

<property name="cronExpression" value="0/5 * * * * ?"/>

I need to read this value dynamically as a parameter passed to my controller.


Inject the Scheduler into one of your beans and invoke scheduleJob(). You can pass it anything you want.


To solve this issue, I used the approach used in a blog entry titled Dynamic Scheduling with Java/Spring

0

精彩评论

暂无评论...
验证码 换一张
取 消