方式一:

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. RUP---统一软件开发过程

    更详细的见:http://www.ibm.com/developerworks/cn/rational/r-rupbp/ 本文引用:http://baike.baidu.com/view/223583 ...

  2. Ngxtop-Nginx日志实时分析利器

    ngxtop实时解析nginx访问日志,并且将处理结果输出到终端,功能类似于系统命令top,所以这个软件起名ngxtop.有了ngxtop,你可以实时了解到当前nginx的访问状况,再也不需要tail ...

  3. Andrew Ng Machine Learning 专题【Linear Regression】

    此文是斯坦福大学,机器学习界 superstar - Andrew Ng 所开设的 Coursera 课程:Machine Learning 的课程笔记. 力求简洁,仅代表本人观点,不足之处希望大家探 ...

  4. Ofstream的endl不好用怎么回事?

    用endl,std::endl, "\n"都不好用,不输出换行,怎么回事? [解决方法] If you're writing a text file, you shouldn't ...

  5. Mongo读书笔记2 -- 数据类型

      Mongo有多种类型的collection, 默认的是随着document 数目的增多自动增大; 还有一些collection被称为capped collection, 只能包含固定数目的docu ...

  6. [Javascirpt] Immediately-Invoked function!!! IMPORTANT

    var parkRides = [["Birch Bumpers", 40], ["Pines Plunge", 55], ["Cedar Coast ...

  7. @SuppressLint("NewApi")和@TargetApi()的区别

    在Android代码中,我们有时会使用比我们在AndroidManifest中设置的android:minSdkVersion版本更高的方法,此时编译器会提示警告, 解决方法是在方法上加上@Suppr ...

  8. mac 终端 使用 solarized 主题设置语法高亮

    mac 终端 使用 solarized 主题设置语法高亮 先来看看 solarized 在 mac 终端上的效果图片 一:先下载 solarized 官网下载:https://github.com/a ...

  9. 使用Fiddler抓包调试https下的页面

    众所周知https技术诞生以来,一个很重要的作用就是加密通信内容.所以在项目团队将业务站点实施完https改造以后,原先使用fiddler进行抓包的美好生活到头了.其实fiddler本身是支持对于ht ...

  10. Banner尺寸多大最好!

    关于网站图片的大小问题 最近发现各大网站的图片做的都很大 随笔找了一个,下载其页面banner, 详细属性:基本全是1920*高.Get√