<!-- 定义调用对象和调用对象的方法 -->
<!-- 定时任务 A start -->
<bean id="jobtask"
class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
<!-- 调用的类 -->
<property name="targetObject"><ref bean="quartzJobAction" /></property>
<!-- 调用类中的方法 -->
<property name="targetMethod"><value>updateData</value></property>
</bean>
<!-- 定义触发时间 -->
<bean id="doTime" class="org.springframework.scheduling.quartz.CronTriggerBean">
<property name="jobDetail">
<ref bean="jobtask" />
</property>
<!-- cron表达式 -->
<property name="cronExpression">
<value>0 0 2 * * ?</value>
</property>
</bean>
<!-- 定时任务 A end --> <!-- 定时任务 B start 未支付的订单三天状态自动关闭 -->
<bean id="orderJob"
class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
<property name="targetObject"><ref bean="payService" /></property>
<property name="targetMethod"><value>updateOrderStatus</value></property>
</bean>
<bean id="triggerTime" class="org.springframework.scheduling.quartz.CronTriggerBean">
<property name="jobDetail"><ref bean="orderJob" /></property>
<property name="cronExpression">
<!-- 每天凌晨1点执行一次 (测试每分钟执行一次 0 */1 * * * ?) -->
<value>0 0 1 * * ?</value>
</property>
</bean>
<!-- 定时任务 B end --> <!-- 总管理类 如果将lazy-init='false'那么容器启动就会执行调度程序 -->
<bean id="startQuertz" lazy-init="false" autowire="no"
class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
<property name="triggers">
<list>
<ref bean="doTime" />
<ref bean="triggerTime" />
</list>
</property>
</bean>

spring 定时任务(3)--配置多个定时任务的更多相关文章

  1. 使用spring+quartz配置多个定时任务

    Spring被用在了越来越多的项目中, quartz也被公认为是比较好用的定时器设置工具, 在这里通过一个demo说明如何使用spring和quartz配置多个定时任务. 环境: eclipse + ...

  2. spring Quartz多个定时任务的配置

    Quartz多个定时任务的配置 1,配置文件与spring整合,需要在spring 的总配置中一入或者在web.xml中spring监听中加上 ztc_cp-spring-quartz.xml 注:定 ...

  3. Spring Boot整合Quartz实现定时任务表配置

    最近有个小项目要做,spring mvc下的task设置一直不太灵活,因此在Spring Boot上想做到灵活的管理定时任务.需求就是,当项目启动的时候,如果有定时任务则加载进来,生成schedule ...

  4. Spring+Quartz 实现定时任务的配置方法

    Spring+Quartz 实现定时任务的配置方法 整体介绍 一.Quartz介绍 在企业应用中,我们经常会碰到时间任务调度的需求,比如每天凌晨生成前天报表,每小时生成一次汇总数据等等.Quartz是 ...

  5. spring多个定时任务quartz配置

    spring多个定时任务quartz配置 <?xml version=”1.0″ encoding=”UTF-8″?> <beans xmlns=”http://www.spring ...

  6. Spring Task定时任务的配置和使用详解

    spring中使用定时任务 1.基于xml配置文件使用定时任务 首先配置spring开启定时任务 <beans xmlns="http://www.springframework.or ...

  7. spring定时任务的配置式与注解式

    在定时任务配置文件中添加内容: <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi=&q ...

  8. Spring 3整合Quartz 2实现定时任务--转

    常规整合 http://www.meiriyouke.net/?p=82 最近工作中需要用到定时任务的功能,虽然Spring3也自带了一个轻量级的定时任务实现,但感觉不够灵活,功能也不够强大.在考虑之 ...

  9. spring boot项目中处理Schedule定时任务

    项目中,因为使用了第三方支付(支付宝和微信支付),支付完毕后,第三方支付平台一般会采用异步回调通知的方式,通知商户支付结果,然后商户根据通知内容,变更商户项目支付订单的状态.一般来说,为了防止商户项目 ...

  10. Spring Boot中使用@Scheduled创建定时任务

    我们在编写Spring Boot应用中经常会遇到这样的场景,比如:我需要定时地发送一些短信.邮件之类的操作,也可能会定时地检查和监控一些标志.参数等. 创建定时任务 在Spring Boot中编写定时 ...

随机推荐

  1. shell重定向

    输入重定向 和输出重定向一样,Unix 命令也可以从文件获取输入,语法为: command < file 这样,本来需要从键盘获取输入的命令会转移到文件读取内容. 注意:输出重定向是大于号(&g ...

  2. 匿名函数中undefined形参疑问(转载)

    唉,基本功不扎实,昨天在微博上问了个问题,就匿名函数中undefined形参,不知道是干什么用的. 经常看到这样的匿名函数代码: ;(function( $, window, document,und ...

  3. code 代码分析 及其解决方案

    官网地址:http://msdn.microsoft.com/zh-cn/library/ms182135.aspx [FxCop.设计规则]11. 不应该使用默认参数 参考地址:http://blo ...

  4. 关于找不到stdafx.h头文件问题

    代码: #include "stdafx.h" #include "stdlib.h" char* getcharBuffer() { return " ...

  5. UESTC_邱老师的脑残粉 2015 UESTC Training for Graph Theory<Problem D>

    D - 邱老师的脑残粉 Time Limit: 12000/4000MS (Java/Others)     Memory Limit: 65535/65535KB (Java/Others) Sub ...

  6. k-d Tree in TripAdvisor

    Today, TripAdvisor held a tech talk in Columbia University. The topic is about k-d Tree implemented ...

  7. LeeCode(Database)-Customers Who Never Order

    Suppose that a website contains two tables, the Customers table and the Orders table. Write a SQL qu ...

  8. FastJson的简单使用(alibaba)

    原文章:http://blog.csdn.net/glarystar/article/details/6654494 原作者:张星的博客 maven配置: <dependency> < ...

  9. 用Matlab完成:从第一个人开始报数(从1到3报数),凡报到3的人退出圈子,问最后留下的是原来第几号的那位。

    程序思路: (1)一圈人循环报数,报数报到3的人,将其置为0,表示被淘汰: (2)那么在接下去的循环中,被淘汰的人不参与报数: (3)直到仅有1人没被淘汰,并显示出他之前的编号. 程序实现如下: cl ...

  10. poj1080--Human Gene Functions(dp:LCS变形)

    Human Gene Functions Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 17206   Accepted:  ...