<bean id="exportBatchFileTask" class="com.ydcn.pts.task.ExportBatchFileTask"></bean>
<bean id="readBatchFileTask" class="com.ydcn.pts.task.ReadBatchFileResultTask"></bean> <!-- 生成开卡档,停卡档,上传开卡停卡档,生成点数转移档 -->
<bean id="executeExportOpenAndBlackCardFilesJob"
class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
<property name="targetObject"> //目标对象
<ref bean="exportBatchFileTask" /> //我们上面定义的定时任务bean
</property>
<property name="targetMethod"> //目标方法
<value>executeExportOpenAndBlackCardFiles</value> //我们在 ExportBatchFileTask 内部定义的方法的名称
</property>
</bean> <!-- 上传点数转移档,上传-->
<bean id="exeExportTransPointsFilesJob"
class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
<property name="targetObject"> //目标对象
<ref bean="exportBatchFileTask" /> //我们在上面定义的定时任务bean
</property>
<property name="targetMethod"> //目标方法
<value>uploadTransPointsBatchFiles</value> //在定时任务中的方法
</property>
</bean> <!-- 定时下载批次档,插入数据库-->
<bean id="downLoadBatchResultFilesJob"
class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
<property name="targetObject">
<ref bean="readBatchFileTask" />
</property>
<property name="targetMethod">
<value>downLoadBatchResultFiles</value>
</property>
</bean> <!-- 解析所有结果档,插入数据库-->
<bean id="execReadAllJob"
class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
<property name="targetObject">
<ref bean="readBatchFileTask" />
</property>
<property name="targetMethod">
<value>execAll</value>
</property>
</bean> <!-- 读取CSV文件 -->
<bean id="execReadCSVFileJob"
class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
<property name="targetObject">
<ref bean="readBatchFileTask" />
</property>
<property name="targetMethod">
<value>readCSVFile</value>
</property>
</bean> <!-- 定义生成开卡停卡档,上传 触发时间 -->
<bean id="executeExportOpenAndBlackCardFilesCron" class="org.springframework.scheduling.quartz.CronTriggerBean">
<property name="jobDetail"> //定时任务的工作详细
<ref bean="executeExportOpenAndBlackCardFilesJob" /> //我们上名定义的定时任务工作bean
</property>
<property name="cronExpression">
<value>0 30 15 * * ?</value> //定时任务工作的时间:value中[0 30 15 * * ?] 分别代表 [秒 分 时 天 月 ]
</property>
</bean> <!-- 定义生成点数转移详细,上传 触发时间 -->
<bean id="exeExportTransPointsFilesCron" class="org.springframework.scheduling.quartz.CronTriggerBean">
<property name="jobDetail">
<ref bean="exeExportTransPointsFilesJob" />
</property>
<property name="cronExpression">
<value>0 0 21 * * ?</value>
</property>
</bean> <!-- 定义读取文件目录,并且插入数据库 -->
<bean id="downLoadBatchResultFilesCron" class="org.springframework.scheduling.quartz.CronTriggerBean">
<property name="jobDetail">
<ref bean="downLoadBatchResultFilesJob" />
</property>
<property name="cronExpression">
<value>0 0/1 * * * ?</value>
</property>
</bean> <!-- 定义读取开卡结果的时间 -->
<bean id="execReadAllCron" class="org.springframework.scheduling.quartz.CronTriggerBean">
<property name="jobDetail">
<ref bean="execReadAllJob" />
</property>
<property name="cronExpression">
<value>0 0/1 * * * ?</value>
</property>
</bean> <!-- 读取csv文件 -->
<bean id="execReadCSVFileCron" class="org.springframework.scheduling.quartz.CronTriggerBean">
<property name="jobDetail">
<ref bean="execReadCSVFileJob" />
</property>
<property name="cronExpression">
<value>0 0/1 * * * ?</value>
</property>
</bean> <!-- 总管理类 如果将lazy-init='false'那么容器启动就会执行调度程序 -->
<bean id="startQuertz" lazy-init="false" autowire="no"
class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
<property name="triggers">
<list>
<!-- <ref bean="executeExportOpenAndBlackCardFilesCron" /> -->
<!-- <ref bean="exeExportTransPointsFilesCron" /> -->
<ref bean="downLoadBatchResultFilesCron" />
<ref bean="execReadAllCron"/>
<!-- <ref bean="execReadCSVFileCron"/> -->
</list>
</property>
</bean>

关于时间表达是的问题这里:http://www.cnblogs.com/skyblue/p/3296350.html 有详细的介绍,我在这里就不多说了。

spring + Quartz定时任务配置的更多相关文章

  1. spring quartz定时任务 配置

    cronExpression表达式: 字段 允许值 允许的特殊字符秒 0-59 , - * /分 0-59 , - * /小时 0-23 , - * /日期 1-31 , - * ? / L W C月 ...

  2. spring的定时任务配置

    本文来源于:http://myspace1916.iteye.com/blog/1570707 也可参考:http://www.oschina.net/question/8676_9032 (个人只是 ...

  3. Spring的定时任务配置2(转)

    spring的定时任务配置分为三个步骤: 1.定义任务 2.任务执行策略配置 3.启动任务 1.定义任务 <!--要定时执行的方法--> <bean id="testTas ...

  4. Spring的定时任务配置(转)

    spring的定时任务配置分为三个步骤: 1.定义任务 2.任务执行策略配置 3.启动任务 1.定义任务 <!--要定时执行的方法--> <bean id="testTas ...

  5. Spring quartz定时任务service注入问题

    今天想单元测试一下spring中的quartz定时任务,job类的大致结构和下面的SpringQtz1类相似,我的是实现的org.quartz.Job接口,到最后总是发现job类里注入的service ...

  6. Spring Quartz定时任务设置

    这里主要记录一下定时任务的配置,偏向于记录型的一个教程,这里不阐述Quartz的原理. 首先,在Spring配置文件里配置一个自己写好的一个包含执行任务方法的一个类. <bean id=&quo ...

  7. [Spring] - Quartz定时任务 - Annotation

    Spring + Quartz可以使用annoation方式: 1.AppJob类: package com.my.quartz.testquartz1; import org.springframe ...

  8. Spring+Quartz(定时任务)

    此处用到的Quartz版本是quartz-2.2.3 官方网站:http://www.opensymphony.com/quartz 首先先介绍用到的几个关键类:scheduler任务调度.Job任务 ...

  9. [Spring] Java spring quartz 定时任务

    首先,需要导入quartz 的jar包 ① applicationContext.xml <!-- 轮询任务 --> <import resource="classpath ...

随机推荐

  1. 【转】Android TouchEvent事件传递机制

    Android TouchEvent事件传递机制   事件机制参考地址: http://www.cnblogs.com/sunzn/archive/2013/05/10/3064129.html ht ...

  2. 11.聚合(Aggregation)

    聚合关系是关联关系的一种特例,它体现的是整体与部分的关系,即has-a的关系,此时整体与部分之间是可分离的,它们可以具有各自的生命周期.比如计算机与CPU.公司与员工的关系等.表现在代码层面,和关联关 ...

  3. mysql修改用户密码 新增用户

    修改密码: mysql> grant all privileges on *.* to yongfu_b@'192.168.1.%' identified by 'my_password_new ...

  4. cocos2dx 网络编程(CCHttpRequest和CURL两个方式)

    转自:http://blog.csdn.net/sg619262284/article/details/20144087 在使用之前需要设置一些参数:参考:http://blog.csdn.net/w ...

  5. HITAG 1/2/S

    HITAG S -- 3rd generation HITAG™ family Modulation Read/Write Device to Transponder: 100 % ASK and B ...

  6. CORTEX -M3 : Registers in depth

    http://www.zembedded.com/cortex-m3-registers-in-depth/ Thanks for the overwhelm response you show in ...

  7. 气泡形提示控件grumble.js

    grumble.js 是一个很特别的气泡形状提示控件,最开始是为 Huddle.com 网站开发的, 它没有通常的north/east/south/west的定位限制. 任何一个grumble都可以放 ...

  8. Codeforces Round #308 (Div. 2) C. Vanya and Scales dfs

    C. Vanya and Scales Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/552/p ...

  9. 在Android应用中实现Google搜索的例子

    有一个很简单的方法在你的 Android 应用中实现 Google 搜索.在这个例子中,我们将接受用户的输入作为搜索词,我们将使用到 Intent.ACTION_WEB_SEARCH . Google ...

  10. 【JavaScript】HTML5存储方案

    1.Web SQL 2.IndexedDB 3.Local Storage 4.Session Storage 5.Cookies 6.Application Cache