任务调度器配置文件

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.1.xsd">

<!-- 任务明细bean -->
<bean id="jobDetailBean" class="org.springframework.scheduling.quartz.JobDetailBean">
<!-- 通过任务类指定石英任务 -->
<property name="jobClass" value="com.scheduler.CreateLogTablesTask"/>
<property name="jobDataMap">
<map>
<entry key="logService" value-ref="logService"></entry>
</map>
</property>
</bean>

<!-- cron触发器bean,设置石英任务的调度策略 -->
<bean id="cronTriggerBean" class="org.springframework.scheduling.quartz.CronTriggerBean">
<property name="jobDetail" ref="jobDetailBean" />
<property name="cronExpression"> <!-- cron表达式 -->
<!-- 秒 分 时 天 月 周 年 -->
<value>0 25 21 20 * ?</value>
</property>
</bean>

<!-- 调度工厂bean,激活触发器运行 -->
<bean id="schedulerFactoryBean" class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
<property name="triggers">
<list>
<ref bean="cronTriggerBean"/>
</list>
</property>
</bean>

</beans>

posted @ 2016-08-15 09:25  李清欣  阅读(214)  评论(0编辑  收藏  举报