1. 程式人生 > >Quartz定時器設定

Quartz定時器設定

<!-- 配置定時任務 -->



    
    <bean class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
        <property name="triggers">
            <list>
            <ref local="payRemindTask"/>
            <ref local="receiveRemindTask"/>
            <ref local="updateCompleteTask"/>
            </list>
        </property>
    </bean>
    
    <bean id="payRemindTask" class="org.springframework.scheduling.quartz.CronTriggerBean">
        <property name="jobDetail">
            <ref bean="payRemind"/>
        </property>
        <property name="cronExpression">
            <value>0 0 10 * * ?</value>
        </property>
    </bean>
     <bean id="receiveRemindTask" class="org.springframework.scheduling.quartz.CronTriggerBean">
        <property name="jobDetail">
            <ref bean="receiveRemind"/>
        </property>
        <property name="cronExpression">
            <value>0 0 3 * * ?</value>
        </property>
    </bean>
    <bean id="updateCompleteTask" class="org.springframework.scheduling.quartz.CronTriggerBean">
        <property name="jobDetail">
            <ref bean="updateComplete"/>
        </property>
        <property name="cronExpression">
            <value>0 0 2 * * ?</value>
        </property>
    </bean>
    
    
    <bean id="payRemind"
        class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
        <property name="targetObject"><ref bean="payRemindAction"/></property>
        <property name="targetMethod"><value>payRemind</value></property>
    </bean>
    <bean id="receiveRemind"
        class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
        <property name="targetObject"><ref bean="receiveRemindAction"/></property>
        <property name="targetMethod"><value>receiveRemind</value></property>
    </bean>
    <bean id="updateComplete"
        class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
        <property name="targetObject"><ref bean="updateCompleteAction"/></property>
        <property name="targetMethod"><value>updateComplete</value></property>
    </bean>
    
    
    
     <bean id="payRemindAction" class="com.pdsu.edu.action.QuartzAction"></bean>
         <bean id="receiveRemindAction" class="com.pdsu.edu.action.QuartzAction"></bean>
         <bean id="updateCompleteAction" class="com.pdsu.edu.action.QuartzAction"></bean>