方式一:

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. IIS-设置session时间

    session会话类型

  2. Effective C++ 条款27

    尽量少做转型动作 尽量少做转型动作有什么目的?非常明显无非就是提高程序的稳定性.提高程序的运行效率. 那么.有哪些转型方式?每种方式都有什么弱点? 这是我们本节学习的重点. C++有四种转型: con ...

  3. ystem.Windows.Forms.SplitContainer : ContainerControl, ISupportInitialize

    #region 程序集 System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 ...

  4. C#.NET常见问题(FAQ)-如何强制退出进程

    可以使用Process.Kill方法,但是有时候执行完了该进程还在,要等一会才会自动关掉     更多教学视频和资料下载,欢迎关注以下信息: 我的优酷空间: http://i.youku.com/ac ...

  5. Android 之数据传递小结

    Android开发中,在不同模块(如Activity)间经常会有各种各样的数据需要相互传递,常用的的有五种传递方式.它们各有利弊,有各自的应用场景.下面分别介绍一下: 1. Intent对象传递简单数 ...

  6. MSP430F5438 I2C学习笔记——AT24C02

    0.前言 对于大多数单片机来说,I2C成了一个老大难问题.从51时代开始,软件模拟I2C成了主流,甚至到ARMCortex M3大行其道的今天,软件模拟I2C依然是使用最广的方法.虽然软件模拟可以解决 ...

  7. java面试第十八天

    软件开发流程: 1.可行性分析 2.需求分析->开发测试 3.概要设计->分隔模块,定义框架等 4.详细设计->类设计.接口设计 5.编码 6.测试 7.部署 8.维护 单元测试: ...

  8. Python 迭代dict的value

    迭代dict的value 1:values() 2:itervalues()  3:for key in Di:     print (Di[key]) 我们已经了解了dict对象本身就是可迭代对象, ...

  9. LeetCode 37 Count and Say

    The count-and-say sequence is the sequence of integers beginning as follows: 1, 11, 21, 1211, 111221 ...

  10. sublime Text3 JsFormat

    https://github.com/sprinng/JsFormat 下载解压 放到 首选项 --> 浏览插件目录 重启sublime ctrl+shift+p 安装 使用: 右键JsForm ...