Spring and quartz implement recurring tasks

Source: Internet
Author: User

<!--task scheduling test implementation one: The custom Task object Com.bocloud.equipment.test.ExampleJob must inherit the Quartzjobbean class, implementing an abstract method Executeinternal creates a new task object each time a task is executed.-- ><bean id= "Myjobdetail" class= "Org.springframework.scheduling.quartz.JobDetailBean" > <!-- The Jobclass property cannot be specified as a Examplejob object through ref, which receives a class-type parameter for task scheduling, each time a new Jobclass object to execute the Executeinternal method-< Property Name= "Jobclass" value= "Com.bocloud.equipment.test.ComputerInfoGatherJob"/></bean><bean id= " Crontrigger "class=" Org.springframework.scheduling.quartz.CronTriggerFactoryBean "> <property name="  Jobdetail "ref=" Myjobdetail "/> <property name=" cronexpression "value=" 0/10 * * * *? "/></bean><bean Id= "Computerinfogatherscheduler" class= "Org.springframework.scheduling.quartz.SchedulerFactoryBean" > < Property name= "Triggers" > <list> <ref bean= "Crontrigger"/> </list> </ Property></bean> 

  

<!-- task debugging Implementation Test Two: Property TargetObject: Specifies the object property that performs the task Targetmethod: Specifies the method that performs the task, which must be the parameterless method class= " Org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean ">    <property name=" TargetObject "ref=" Computerservice "/>    <property name=" Targetmethod "value=" list "/></bean>     class= "Org.springframework.scheduling.quartz.CronTriggerFactoryBean" >    <property name= " Jobdetail "ref=" Jobdetail "/>    <property name=" cronexpression "value=" 0/10 * * * *? "/></bean>     C9>class= "Org.springframework.scheduling.quartz.SchedulerFactoryBean" >    <property name= "triggers ">        <list>        <ref bean=" Crontrigger "/>    </list>    </property></bean >

Reprint to: http://my.oschina.net/lhplj/blog/213773

A quartz crontrigger expression is divided into seven sub-expressions, each of which is separated by a space, from left to right: seconds, minutes, time, day of the month, month, day of the week, year, and year is not required, which means that any one expression requires a minimum of six items!
Example: 0 0 12? * WED says 12 points per Wednesday, there is no "year" This!

Field name (item) must be of value range special character
Seconds is 0-59,-*/
Cent is 0-59,-*/
Time is 0-23,-*/
The day of the month is 1-31,-*? /L W
Month is 1-12 or JAN-DEC,-*/
The day of the week is 1-7 or SUN-SAT,-*? L
Year no empty, 1970-2099,-*/

Spring and quartz implement recurring tasks

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.