Spring Quartz Scheduler XML Configuration

Spring Quartz Scheduler XML Configuration

In previous tutorial you saw how to create simple Quartz scheduler using java. Those were configuration we did through code which is not good for large project where you want to create many scheduler. In this tutorial you will how to integrate Quartz scheduler through spring XML file so that you could configuration as many as scheduler through XML configuration no extra code needed.

We will create complete project to see how this works:

Tools needed:

  • Any latest version of Eclipse
  • JDK 1.8
  • Quartz jar (Already include in pom.xml)
  • Maven (It comes with eclipse)

Project name: QuartzSchedulerSpring (Its maven project)

Spring Quartz Scheduler XML Configuration

  • Dependencies: pom.xml

  • Spring context: common-context.xml:

  • Scheduler configuration: scheduler-context.xml:

  • Explanation:

Spring Quartz Scheduler XML Configuration

  • Sample cron and you could also validate is on CronMaker

  • JavaHonk.properties: Separately to keep all properties here we are keeping cron time:

  • JavaHonkMainApp.java:

  • JavaHonkScheduler.java:

  • To validate it: Right click JavaHonkMainApp.java –> Run As –> Java Application below will be output:

Spring Quartz Scheduler XML Configuration

Reference:

Leave a Reply

Your email address will not be published. Required fields are marked *