zoukankan      html  css  js  c++  java
  • Spring-quartz定时系统多任务配置

    <!-- 启动触发器的配置开始 -->
    <bean name="startQuertz" lazy-init="false" autowire="no"
    class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
    <property name="triggers">
    <list>
    <ref bean="myJobTrigger" />
    <ref bean="myJobTrigger2" />
    </list>
    </property>
    </bean>
    <!-- 启动触发器的配置结束 -->

    <!-- quartz-2.x的配置 -->
    <bean id="myJobTrigger"
    class="org.springframework.scheduling.quartz.CronTriggerFactoryBean">
    <property name="jobDetail">
    <ref bean="myJobDetail" />
    </property>
    <property name="cronExpression">
    <!-- <value>10 0/30 * * * ?</value> --><!-- Cron表达式“10 */1 * * * ?”意为:从10秒开始,每1分钟执行一次。 -->
    <!-- “59 59 23 * * ?” --><!-- 每天晚上12点执行 -->
    <!-- “0 0/30 * * * ?” --><!-- 每30分钟执行 -->
    <!-- <value>59 59 23 * * ?</value> --> <!-- Cron表达式“0 0 23 10 11 ? 2016”意为:只在2016.11.10 23:00:00 执行。 -->
    <value>0 0 13 ? * WED</value><!-- 每个星期三中午10点邮件提醒 -->
    </property>
    </bean>


    <bean id="myJobTrigger2"
    class="org.springframework.scheduling.quartz.CronTriggerFactoryBean">
    <property name="jobDetail">
    <ref bean="myJobDetail2" />
    </property>
    <property name="cronExpression">
    <!-- <value>10 0/30 * * * ?</value> --><!-- Cron表达式“10 */1 * * * ?”意为:从10秒开始,每1分钟执行一次。 -->
    <!-- “59 59 23 * * ?” --><!-- 每天晚上12点执行 -->
    <!-- “0 0/30 * * * ?” --><!-- 每30分钟执行 -->
    <value>0 16 17 * * ? 2017</value> <!-- Cron表达式“0 0 23 10 11 ? 2016”意为:只在2016.11.10 23:00:00 执行。 -->
    <!-- <value>0 0 10 ? * WED</value> --><!-- 每个星期三中午10点邮件提醒 -->
    </property>
    </bean>

    <!-- 调度的配置结束 -->

    <!-- job的配置开始 -->
    <bean id="myJobDetail"
    class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
    <property name="targetObject">
    <ref bean="job" />
    </property>
    <property name="targetMethod">
    <value>emailremind</value><!-- 执行定时操作的方法名 -->
    </property>
    </bean>
    <bean id="myJobDetail2"
    class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
    <property name="targetObject">
    <ref bean="job" />
    </property>
    <property name="targetMethod">
    <value>getChanDaoProject</value><!-- 执行定时操作的方法名 -->
    </property>
    </bean>
    <!-- job的配置结束 -->

    <!-- 工作的bean -->
    <bean id="job" class="com.xdfstar.back.action.BackInviationAction" />

  • 相关阅读:
    array_map()与array_shift()搭配使用 PK array_column()函数
    Educational Codeforces Round 8 D. Magic Numbers
    hdu 1171 Big Event in HDU
    hdu 2844 poj 1742 Coins
    hdu 3591 The trouble of Xiaoqian
    hdu 2079 选课时间
    hdu 2191 珍惜现在,感恩生活 多重背包入门题
    hdu 5429 Geometric Progression 高精度浮点数(java版本)
    【BZOJ】1002: [FJOI2007]轮状病毒 递推+高精度
    hdu::1002 A + B Problem II
  • 原文地址:https://www.cnblogs.com/coderdxj/p/6393112.html
Copyright © 2011-2022 走看看