Dynamically scheduling quartz cron job in spring?

20,894

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

Share:
20,894
Ali Taha Ali Mahboub
Author by

Ali Taha Ali Mahboub

Updated on November 20, 2020

Comments

  • Ali Taha Ali Mahboub
    Ali Taha Ali Mahboub over 3 years

    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 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.

  • Ali Taha Ali Mahboub
    Ali Taha Ali Mahboub over 12 years
    what do you mean by "into one of your beans" Do you mean a java bean? or a bean in my app-config.xml? Please support me with more details, or examples.