1. Introduction of quartz jar Pack Quartz-all-1.8.6.jar except Spring.jar
2. Task class Quartzjob public class Quartzjob {public void Work1 () System.out.println ("Quartz Task Scheduling ... Work1 enable ... "); WORK2 () A System.out.println ("Quartz task schedule ...") Work2 enable ... "); 11} 12 13 14}
2.Spring configuration quartz-config.xml View Source printing? <?xml version= "1.0" encoding= "UTF-8"?> <beans xmlns= "http://www.springframework.org /schema/beans " xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance "xmlns:jee=" http:/ /www.springframework.org/schema/jee " xsi:schemalocation=" http:// Www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd 05 Http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-2.0.xsd "> 06 Modified !--thread executor configuration for task registration--> <bean id= "Executor" class= " Org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor "> <property name= "Corepoolsize" value= "ten" /> &nbSp;<property name= "Maxpoolsize" value= " />" <property name= "queuecapacity" value= " />" </ bean> <!--the work class to invoke--> <bean id= " Quartzjob " class=" Quartzjob "></bean> <!-- Scheduling business: Defining methods for calling objects and calling objects--> <bean id= "Jobtask1" class= "Org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean" > <!--called class--> <property name= "TargetObject" ref= "Quartzjob" /> <!--methods in the calling class--> <property&nbsP;name= "Targetmethod" value= "Work1" /> </bean> <bean id= "Jobtask2" class= "Org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean" > <!--called class--> <property name= "TargetObject" ref= "Quartzjob" /> <!--calling methods in a class--> <property name= "TargetMethod" value= "Work2" /> </bean> Notoginseng <!--define trigger time--> <bean id= "doTime1" class= " Org.springframework.scheduling.quartz.CronTriggerBean "> &nbSp;<property name= "Jobdetail" ref= "Jobtask1" /> <!--cron expression--><!--perform an--> every 10 seconds < Property name= "Cronexpression" value= "0/3 * * * *?" /> </bean> <bean id= "DoTime2" class= "Org.springframework.scheduling.quartz.CronTriggerBean" > <property name= "Jobdetail" ref= "Jobtask2" /> 47 <property name= "Cronexpression" value= "0/5 * * * *?" />