Quartz Spring Configuration timed Trigger

Source: Internet
Author: User

1 <BeanID= "Kintaiadditionalcreating"class= "Com.kng.timevalue.kintaiAdditional.KintaiAdditionalCreating" />2The first line is<!-- the work class to invoke-- 
第3-11 Line     <!--the implementation class for the specified task bean-<!--injects properties to the task bean-
3 <Beanname= "Kintaijob"class= "Org.springframework.scheduling.quartz.JobDetailBean">4 < Propertyname= "Jobclass"value= "Com.kng.timevalue.kintaiAdditional.KintaiJob" />5 <!--the implementation class for the specified task bean--6 < Propertyname= "Jobdataasmap"><!--inject properties into the task bean-- 7 <Map>8 <entryKey= "Kintaicreating"Value-ref= "Kintaiadditionalcreating" />9 </Map>Ten </ Property> One </Bean> A第13-16 Line<!-- Define trigger time - - <BeanID= "Kintaicrontrigger"class= "Org.springframework.scheduling.quartz.CronTriggerBean"> - < Propertyname= "Jobdetail"ref= "Kintaijob" /> the < Propertyname= "Cronexpression"value= "0 * * * *" /> - </Bean> -第18-30 row definition Management - <Beanclass= "Org.springframework.scheduling.quartz.SchedulerFactoryBean"> + < Propertyname= "Jobdetails"> - <List> + <refBean= "Kintaijob" /> A </List> at </ Property> - - < Propertyname= "Triggers"> - <List> - <refBean= "Kintaicrontrigger" /> - </List> in </ Property> - </Bean>
1  Public classKintaijobextendsQuartzjobbean {2 3 @Autowired4     Privatekintaiadditionalcreating kintaicreating;5 6     7 8     /**9      * @paramkintaicreating the kintaicreating to setTen      */ One      Public voidsetkintaicreating (kintaiadditionalcreating kintaicreating) { A          This. kintaicreating =kintaicreating; -     } -  the  -  -     protected voidexecuteinternal (jobexecutioncontext context) -             throwsjobexecutionexception { + Kintaicreating.addkintai (); -     } +  A}
the second piece of code is to write the job class Punchjob( the class must inherit Quartzjobbean)

This class of kintaiadditionalcreating writes the logic to be implemented.

Quartz Spring Configuration timed Trigger

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.