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