标签:quartz.xml
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:cache="http://www.springframework.org/schema/cache"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd
http://www.springframework.org/schema/cache
http://www.springframework.org/schema/cache/spring-cache-3.2.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.2.xsd">
<!-- 定时器1 -->
<!-- 要调用的工作类 -->
<bean id="AutoCreateReportTask" class="cn.wisdom.web.scheduling.AutoCreateReportTask">
<property name="baseDao" ref="baseDao" />
</bean>
<!--调度业务 : 定义调用对象和调用对象的方法 -->
<bean id="jobtask1"
class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
<!-- 调用的类 -->
<property name="targetObject" ref="AutoCreateReportTask" />
<!-- 调用类中的方法 -->
<property name="targetMethod" value="crateReport" />
</bean>
<!-- 定义触发时间 -->
<bean id="doTime1"
class="org.springframework.scheduling.quartz.CronTriggerFactoryBean">
<property name="jobDetail" ref="jobtask1" />
<!-- cron表达式 --><!-- 每隔10秒执行一次 -->
<property name="cronExpression" value="0/10 * * * * ?" />
</bean>
<!-- 定时器2 删除失效未被引用的文件 -->
<!-- 要调用的工作类 -->
<bean id="AutoDeleteInvalidDocument" class="cn.wisdom.web.scheduling.AutoDeleteInvalidDocument">
<property name="baseDao" ref="baseDao" />
</bean>
<!--调度业务 : 定义调用对象和调用对象的方法 -->
<bean id="jobtask2"
class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
<!-- 调用的类 -->
<property name="targetObject" ref="AutoDeleteInvalidDocument" />
<!-- 调用类中的方法 -->
<property name="targetMethod" value="deleteInvalidDocument" />
</bean>
<!-- 定义触发时间 -->
<bean id="doTime2"
class="org.springframework.scheduling.quartz.CronTriggerFactoryBean">
<property name="jobDetail" ref="jobtask2" />
<!-- cron表达式 --><!-- 每隔10秒执行一次 -->
<property name="cronExpression" value="0 0 0 * * ?" />
</bean>
<!--设置调度 总管理类 如果将lazy-init=‘false‘那么容器启动就会执行调度程序 -->
<bean id="startQuartz" lazy-init="false" autowire="no"
class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
<property name="triggers">
<list>
<!-- <ref bean="doTime1" /> -->
<ref bean="doTime2" />
</list>
</property>
<property name="taskExecutor" ref="taskExecutor" />
</bean>
</beans>
本文出自 “abc” 博客,谢绝转载!
标签:quartz.xml
原文地址:http://10264855.blog.51cto.com/10254855/1971229