在春天动态调度石英cron工作? [英] Dynamically scheduling quartz cron job in spring?

查看:127
本文介绍了在春天动态调度石英cron工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目前我在这个链接中运行Quartz调度程序示例
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/

我的问题是这个
我如何在CronTrigger bean中添加动态时间,而不是硬编码时间:

My question is this How can I add 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.

推荐答案

将调度程序注入其中一个bean并调用 scheduleJob()。你可以传递任何你想要的。

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

这篇关于在春天动态调度石英cron工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆