The first need of the jar package, preferably 1.8.5, the other version of spring if the version is not high, will be error
<Dependency> <groupId>Org.quartz-scheduler</groupId> <Artifactid>Quartz</Artifactid> <version>1.8.5</version> </Dependency>
<?XML version= "1.0" encoding= "UTF-8"?><Beansxmlns= "Http://www.springframework.org/schema/beans"Xmlns:xsi= "Http://www.w3.org/2001/XMLSchema-instance"XMLNS:AOP= "HTTP://WWW.SPRINGFRAMEWORK.ORG/SCHEMA/AOP"Xmlns:context= "Http://www.springframework.org/schema/context"Xmlns:tx= "Http://www.springframework.org/schema/tx"xsi:schemalocation= "Http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd HTTP://WWW.SPRINGFRAMEWORK.ORG/SCHEMA/AOP http://www.springframework.org/schema/aop/spring-aop.xsd http: Www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd Http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd "> <!--Thread executor configuration for task registration - <BeanID= "Executor"class= "Org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor"> < Propertyname= "Corepoolsize"value= "Ten" /> < Propertyname= "Maxpoolsize"value= "+" /> < Propertyname= "Queuecapacity"value= "$" /> </Bean> <!--Business Objects, the classes that define their own operations business - <BeanID= "Bizobject"class= "Com.um.framework.baseware.webadmin.modules.controller.core.ExpireJobTask" /> <!--Dispatch Business - <BeanID= "Jobdetail"class= "Org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean"> < Propertyname= "TargetObject"ref= "Bizobject" /> < Propertyname= "Targetmethod"value= "Dobiz" /> </Bean> <!--scheduling triggers, triggering by time rules - <BeanID= "Crontrigger"class= "Org.springframework.scheduling.quartz.CronTriggerBean"> < Propertyname= "Jobdetail"ref= "Jobdetail" /> < Propertyname= "Cronexpression"value="* * * * * ?" /> </Bean> <!--scheduling triggers, by time interval - <BeanID= "Tasktrigger"class= "Org.springframework.scheduling.quartz.SimpleTriggerBean"> < Propertyname= "Jobdetail"ref= "Jobdetail" /> < Propertyname= "Startdelay"value= "+" /> < Propertyname= "Repeatinterval"value= "+" /> </Bean> <!--Set Schedule - <Beanclass= "Org.springframework.scheduling.quartz.SchedulerFactoryBean"> < Propertyname= "Triggers"> <List> <refBean= "Tasktrigger" /> <refBean= "Crontrigger" /> </List> </ Property> < Propertyname= "Taskexecutor"ref= "Executor" /> </Bean></Beans>
The configuration file is then introduced into the spring configuration file. The following path is based on its actual path
<import resource= "Classpath:config/spring-context-quartzjob.xml" ></import>
Java class
Package Com.um.framework.baseware.webadmin.modules.controller.core; Public class expirejobtask { /*** //private static final Logger Logger = Loggerfactory.getlogger (expirejobtask.class); /** * Business logic processing */public void dobiz () { System.out.println ("timed task Open"); } }
Spring Integrated Quartz