<!--configured as follows in the spring core configuration file --
<!--Spring based on quartz timed tasks - <BeanID= "Triggerbybeantwo"class= "Cn.zr.pringmvctest.trigger.TriggerByBeanTwo"></Bean> <!--Jobdetail - <BeanID= "Triggerbybeantwojob"class= "Org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean"> <!--the task target object to invoke - < Propertyname= "TargetObject"ref= "Triggerbybeantwo" /> <!--the corresponding method of the task target object to invoke - < Propertyname= "Targetmethod"value= "Simplemission" /> <!--whether concurrency is supported false, such as when a timed task is not over, cannot be executed again, it must be executed before it executes true and the opposite - < Propertyname= "Concurrent"value= "false" /> </Bean> <BeanID= "Simpletrigger"class= "Org.springframework.scheduling.quartz.SimpleTriggerFactoryBean"> <!--Jobdetail, the Task Scheduler that triggers need to perform - < Propertyname= "Jobdetail"ref= "Triggerbybeantwojob" /> <!--startdelay container starts after 10 seconds delay - < Propertyname= "Startdelay"value= "+" /> <!--Recurrence of the method of execution - < Propertyname= "Repeatinterval"value= "the" /> </Bean> <!--Spring based on quartz timed tasks - <BeanID= "Triggerbybean"class= "Cn.zr.pringmvctest.trigger.TriggerByBean"></Bean> <!--Jobdetail - <BeanID= "Triggerjob"class= "Org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean"> <!--the task target object to invoke - < Propertyname= "TargetObject"ref= "Triggerbybean" /> <!--the corresponding method of the task target object to invoke - < Propertyname= "Targetmethod"value= "TriggerAction" /> <!--whether concurrency is supported false, such as when a timed task is not over, cannot be executed again, it must be executed before it executes true and the opposite - < Propertyname= "Concurrent"value= "false" /> </Bean> <!--define a trigger - <BeanID= "Crontrigger"class= "Org.springframework.scheduling.quartz.CronTriggerFactoryBean"> <!--Jobdetail, the Task Scheduler that triggers need to perform - < Propertyname= "Jobdetail"ref= "Triggerjob" /> <!--Time-expression - < Propertyname= "Cronexpression"value= "0 0-55 * *?" /> <!--startdelay container starts after 10 seconds delay - < Propertyname= "Startdelay"value= "+" /> </Bean> <!--Trigger Chain - <Beanclass= "Org.springframework.scheduling.quartz.SchedulerFactoryBean"> < Propertyname= "Triggers"> <List> <refBean= "Crontrigger" /> <refBean= "Simpletrigger" /> </List> </ Property>
Package Cn.zr.pringmvctest.trigger; Public class Triggerbybean { publicvoid triggeraction () { System.out.println (" Execute the method periodically ");} }
Package Cn.zr.pringmvctest.trigger; Public class Triggerbybeantwo { publicvoid simplemission () { SYSTEM.OUT.PRINTLN ("timer, perform the corresponding task ..."); }
Java-based quartz implementation of timing two (XML mode configuration)