Spring and quartz integration

Source: Internet
Author: User

Package com.chengxi.qs.service;/*** * Executed business logic class * @author Wzh * */public class Jobtask {public void work () {System.out.print ln ("Dispatching task ...");}

<?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:aop= "HTTP://WWW.SPRINGFRAMEWORK.ORG/SCHEMA/AOP" Xmlns:tx = "Http://www.springframework.org/schema/tx" xmlns:context= "Http://www.springframework.org/schema/context" xsi: schemalocation= "Http://www.springframework.org/schema/beans Http://www.springframework.org/schem                            A/beans/spring-beans-3.0.xsd HTTP://WWW.SPRINGFRAMEWORK.ORG/SCHEMA/AOP Http://www.springframework.org/schema/aop/spring-aop-3.0.xsd HTTP://WWW.SPRINGFRAMEWORK.ORG/SC                           Hema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd Http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/ Spring-tx-3.0.xsd "><!--<bean id= "User11" class= "Com.chengxi.qs.model.User"/>-<!--need to invoke the work class--><bean id= "Jobtasktest" class= "Com.chengxi.qs.service.JobTask" ></bean><!--defining the calling object and calling the method--><bean id= "Jobtask" class= " Org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean "><!--called class--><property name = "TargetObject" ><ref bean= "jobtasktest"/></property><!--call methods in class--><property Name= " Targetmethod "><value>work</value></property></bean><!--define trigger time--><bean id=" Dotime "class=" Org.springframework.scheduling.quartz.CronTriggerBean "><property name=" Jobdetail ">< Ref bean= "Jobtask"/></property><!--corn expression--><property name= "Cronexpression" ><value> 10/5 * * * * *?</value></property></bean><!--General Management class if you lazy-init= ' false ' then the container starts executing the scheduler-->< Bean id= "Startquartz" lazy-init= "false" autowire= "no" class= "Org.springframework.scheduling.quartZ.schedulerfactorybean "><property name=" triggers "><list><ref bean=" Dotime "/></list>         </property></bean></beans>
This is a need for the jar pack and don't add less

Then in the SRC directory, remember to add

Log4j.properties



Spring and quartz integration

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.