方式一:

1.定时任务配置文件

src/main/resources/spring-mvc-timeTask.xml

2.新定义一个定时任务举例

a.配置定时任务,配置文件spring-mvc-timeTask.xml

<?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:context="http://www.springframework.org/schema/context"
xmlns:aop="http://www.springframework.org/schema/aop" xmlns:util="http://www.springframework.org/schema/util"
xmlns:tx="http://www.springframework.org/schema/tx" xmlns:task="http://www.springframework.org/schema/task"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-3.0.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.0.xsd"
default-autowire="byName" default-lazy-init="false"> <!-- 定时任务配置 scheduler 方式 注解 -->
<context:component-scan base-package="org.jeecgframework.core.timer" />
<task:executor id="executor" pool-size="5" />
<task:scheduler id="scheduler" pool-size="10" />
<task:annotation-driven executor="executor" scheduler="scheduler" />
<!-- 定时任务调度器 -->
<bean id="schedulerFactory" lazy-init="false" autowire="no" class="org.jeecgframework.core.timer.DataBaseSchedulerFactoryBean">
<property name="triggers">
<list>
<ref bean="xhjCeshiLiufServiceTaskCronTrigger"/>
</list>
</property>
</bean>
<!-- 定时任务业务类 配置loadTask随系统启动,以加载初始启动的定时任务 -->
<bean id="dynamicTask" class="org.jeecgframework.core.timer.DynamicTask" init-method="loadTask"/> <!-- 定时任务 测试任务配置 -->
<bean id="xhjCeshiLiufServiceTaskJob"
class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
<property name="targetObject" ref="xhjCeshiLiufService" />
<property name="targetMethod" value="work" />
<property name="concurrent" value="true" />
</bean>
<!-- 定时任务 测试 Trigger 配置 -->
<bean id="xhjCeshiLiufServiceTaskCronTrigger"
class="org.jeecgframework.core.timer.DataBaseCronTriggerBean">
<property name="jobDetail" ref="xhjCeshiLiufServiceTaskJob" />
<property name="cronExpression" value="0 0/1 * * * ?" />
</bean>
</beans>

b.定时任务在线控制

此类必须继承借口org.quartz.Job

方式二:

如果不做处理的定时任务,推荐使用spring的
注解方式

路径在

任务类

任务执行方法和时间

jeecg 定时任务配置用法的更多相关文章

  1. spring 定时任务配置

    1.(易)如何在spring中配置定时任务? spring的定时任务配置分为三个步骤: 1.定义任务 2.任务执行策略配置 3.启动任务 (程序中一般我们都是到过写的,直观些) 1.定义任务 < ...

  2. spring的定时任务配置

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

  3. CentOS7下Firewall防火墙配置用法详解

    官方文档地址: https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/Security_Guide ...

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

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

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

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

  6. spring3.0注解定时任务配置及说明

    spring注解方式的定时任务配置: 第一步:spring配置文件 <?xml version="1.0" encoding="UTF-8"?> & ...

  7. 【Python】Linux crontab定时任务配置方法(详解)

    CRONTAB概念/介绍 crontab命令用于设置周期性被执行的指令.该命令从标准输入设备读取指令,并将其存放于“crontab”文件中,以供之后读取和执行. cron 系统调度进程. 可以使用它在 ...

  8. 【spring boot】spring boot中使用定时任务配置

    spring boot中使用定时任务配置 =============================================================================== ...

  9. spring boot 整合 quartz 集群环境 实现 动态定时任务配置【原】

    最近做了一个spring boot 整合 quartz  实现 动态定时任务配置,在集群环境下运行的 任务.能够对定时任务,动态的进行增删改查,界面效果图如下: 1. 在项目中引入jar 2. 将需要 ...

随机推荐

  1. WPF 处理路由事件

    (1)img.MouseUp+= img_MouseUp;(2)调用 UIElement.AddHandler()直接连接事件:img.AddHandler(Image.MouseUpEvent, n ...

  2. js 继承概述

    上文讲述过js实现面向对象,一定是能够实现继承的效果的.尽管说非常多的js框架都帮助我们实现了继承的功能.或者说在日常的工作和学习中我们压根就用不到js的继承,可是我们还是须要了解一下js中继承.以方 ...

  3. Postfix接收邮件后转向运行特定的脚本

    本文主要參考:http://serverfault.com/questions/258469/how-to-configure-postfix-to-pipe-all-incoming-email-t ...

  4. 【canvas】N角光阑

    这回把光阑代码统一了,修改angleCount的数目为3就是三角光阑,angleCount的数目为4就是四角光阑,angleCount的数目为6就是六角光阑,目前代码中是12角光阑. 图示: 代码: ...

  5. ios Mac 地址获取

    //mac address #include <sys/socket.h> // Per msqr #include <sys/sysctl.h> #include <n ...

  6. Asp.Net 之 前台绑定常用总结

    1.<%= 变量名 %> 里面放的是后台定义的变量名,如: <div> <p> <%= DateTime.Now.ToString() %></p ...

  7. _PyUnicodeUCS4_AsDefaultEncodedString

    "_PyUnicodeUCS4_AsDefaultEncodedString"的出现一般源于你在两个地方分别装了python,两个分别用UCS2和UCS4编码进行的build. 解 ...

  8. 深入浅出搜索架构引擎、方案与细节 倒排 bitmap

    深入浅出搜索架构引擎.方案与细节(上) 2017-02-14 23:55 58沈剑0  20  阅读 131 一.缘起 <100亿数据1万属性数据架构设计>文章发布后,不少朋友对58同城自 ...

  9. 基于cancel的不全然恢复

    实验:基于cancel的不全然恢复 实验环境查看 lsnrctl status select open_mode from v$database;   --监听与数据库状态 show paramete ...

  10. 转:完成端口(Completion Port)详解

    手把手叫你玩转网络编程系列之三    完成端口(Completion Port)详解                                                           ...