标签:
<!--获取demoTask定时任务start --> <bean id ="demoTask" class="com.bdx.itpl.wcpay.quartz.task.OrdinaryAccessTokenAndJsApiTicketTask" /> <bean id ="demoMethod" class= "org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean" > <property name ="targetObject"> <ref bean ="demoTask"/> </property > <property name ="targetMethod"> <value >execute </value ><!-- 要执行的方法名称 --> </property > </bean > <bean id ="demoBean" class= "org.springframework.scheduling.quartz.CronTriggerFactoryBean" > <property name ="jobDetail" ref= "demoMethod" ></property > <!--每三小时执行一次任务,从整点开始--> <property name ="cronExpression" value="0 0 0/3 * * ?"></property> </bean > <bean id ="demoBean2" class= "org.springframework.scheduling.quartz.CronTriggerFactoryBean" > <property name ="jobDetail" ref= "demoMethod" ></property > <!--每三小时执行一次任务,从一个半小时后开始 --> <property name ="cronExpression" value="0 30 1/3 * * ?"></property> </bean > <!--获取OrdinaryAccessTokenAndJsApiTicketTask定时任务end--> <!-- ======================== 调度工厂 ======================== --> <bean id ="SpringJobSchedulerFactoryBean" class= "org.springframework.scheduling.quartz.SchedulerFactoryBean" > <property name ="triggers"> <list > <ref bean= "demoBean" /> <ref bean= "demoBean2" /> </list > </property >
标签:
原文地址:http://www.cnblogs.com/jtzfeng/p/5694550.html