Step 1:configure Jobs in Quartz Scheduler
A:using Methodinvokingjobdetailfactorybean
<bean id= "Simplejobdetail" class= "Org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean" ><property name= "TargetObject" ><bean class= "Com.job.Task"/></property><property name= " Targetmethod "value=" job "/><property name=" concurrent "value=" true "/></bean>
TargetObject the class to execute
Targetmethod to execute the methods in the class
Concurrent immediate execution immediately (when, after class instantiation)
b:using Jobdetailfactorybean
<bean id= "Complexjobdetail" class= "Org.springframework.scheduling.quartz.JobDetailFactoryBean" >< Property Name= "Jobclass" value= "Com.scheduled.ScheduledJob"/><property name= "Jobdatamap" ><map>< Entry key= "task" value-ref= "task" ></entry></map></property><property name= "durability" Value= "true"/></bean>
Jobclass the class to be executed by the configuration task
Jobdatamap Configuring parameter settings in the execution class
Step 2:configure Triggers to being used in Quartz Scheduler
A:simple Trigger, using Simpletriggerfactorybean
<bean id= "Simpletrigger" class= "Org.springframework.scheduling.quartz.SimpleTriggerFactoryBean" >< Property Name= "Jobdetail" ref= "Simplejobdetail"/><property name= "Startdelay" value= "/><property" Name= "Repeatinterval" value= "/></bean>"
Repeatinterval: This triggers the way, the configured time, 2 seconds trigger once.
B:cron Trigger, using Crontriggerfactorybean
<bean id= "Crontrigger" class= "Org.springframework.scheduling.quartz.CronTriggerFactoryBean" ><property Name= "Jobdetail" ref= "Complexjobdetail"/><property name= "cronexpression" value= "0/5 * *? * Sat-sun "/></bean>
Cronexpression:
Examples of some cron expressions
Meaning of an expression
0 0 10,14,16 * *? Daily 10 o'clock in the morning, 2 o'clock in the afternoon and 4 o'clock in the afternoon
0 0,15,30,45 * 1-10 *? Every 15 minutes in the first 10 days of each month
30 0 0 1 1? 2012 at midnight on January 1, 2012, 30 seconds.
Step 3:configure Schedulerfactorybean that creates and configures Quartz Scheduler
<bean class= "Org.springframework.scheduling.quartz.SchedulerFactoryBean" ><property name= "Jobdetails" ><list><ref bean= "Simplejobdetail"/><ref bean= "Complexjobdetail"/></list></ Property><property name= "triggers" ><list><ref bean= "Simpletrigger"/><ref bean= " Crontrigger "/></list></property></bean>
Finally integrated.
Configuration requirements:
Spring 4 + version
Quartz version 2 or more
Learn from: http://websystique.com/spring/spring-4-quartz-scheduler-integration-example/
Spring 4 + Quartz Integration Example