[quartz] spring quartz 配置

<?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:context="http://www.springframework.org/schema/context"
    xsi:schemaLocation="http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.1.xsd
        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
        http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd">

    <!-- 1.0 要调用的目标对象 -->
    <bean id="DataMapSyn" class="com.company.project.service.DataCache" />

    <!-- 2.0 要调用的目标对象的方法 -->
    <bean id="DataMapSynMethod"
        class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
        <property name="targetObject" ref="DataMapSyn" />
        <property name="targetMethod" value="synData" />
        <property name="concurrent" value="false" /> <!-- 是否并发执行 ,[false]一次没完下一个不开始 -->
    </bean>
    <!-- 3.0 周期性的时间配置 -->
    <bean id="DataMapSynMethodTrigger" class="org.springframework.scheduling.quartz.CronTriggerBean">
        <property name="jobDetail" ref="DataMapSynMethod" />
        <property name="cronExpression" value="0 * 9-18 ? * *" />
        <property name="startDelay" value="10000" /> <!-- 启动延迟10秒 -->
        <!-- <property name="repeatInterval" value="60000" /> <property name="repeatCount" 
            value="20000" /> -->
        <property name="startTime" value="2015/01/01 15:10:10" />
        <property name="endTime" value="2015/12/31 15:10:10" />
    </bean>
    <!-- 总调度 -->
    <bean class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
        <property name="triggers">
            <list>
                <ref bean="DataMapSynMethodTrigger" />
            </list>
        </property>
    </bean>
</beans>

写在数据库中的现在要改为配置。

posted @ 2015-03-25 09:28  snow__wolf  阅读(238)  评论(0)    收藏  举报