Quartz两个定时任务的配置
来源:互联网 发布:海康威视网络配置设置 编辑:程序博客网 时间:2024/05/21 22:49
1、首先与spring进行整合,需要在spring的总配置中或者在web.xml中spring监听中加上
applicationContext-quartz.xml。 我是直接加了个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:p="http://www.springframework.org/schema/p"xmlns:aop="http://www.springframework.org/schema/aop" xmlns:context="http://www.springframework.org/schema/context"xmlns:jee="http://www.springframework.org/schema/jee" xmlns:tx="http://www.springframework.org/schema/tx"xsi:schemaLocation="http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsdhttp://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsdhttp://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsdhttp://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-2.5.xsdhttp://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd"> <!-- 业务创建的定时任务 --><bean id="类名1" class="org.springframework.scheduling.quartz.JobDetailBean"><property name="jobClass"><value>类路径</value></property></bean><bean id="类名2" class="org.springframework.scheduling.quartz.JobDetailBean"><property name="jobClass"><value>类路径</value></property></bean> <!-- 触发器配置 时间指定 -->
<bean id="cronTrigger1" class="org.springframework.scheduling.quartz.CronTriggerBean"><property name="jobDetail" ref="类名1" /><property name="cronExpression"><!--每10秒执行一次 --><value>0/10 * * * * ?</value></property></bean>
<!-- 触发器配置 时间指定 -->
<bean id="cronTrigger2" class="org.springframework.scheduling.quartz.CronTriggerBean"><property name="jobDetail" ref="类名2" /><property name="cronExpression"><!--每10秒执行一次 --><value>0/10 * * * * ?</value></property></bean><!-- 总管理类 如果将lazy-init='false' 那么容器启动就会执行调度程序 --><bean id="schedulerFactoryBean" lazy-init="false" autowire="no"class="org.springframework.scheduling.quartz.SchedulerFactoryBean"><property name="configLocation" value="classpath:quartz.properties" /><property name="applicationContextSchedulerContextKey" value="applicationContext" /><property name="triggers"><list><ref bean="cronTrigger1" /><ref bean="cronTrigger2" /></list></property></bean></beans>
阅读全文
0 0
- Quartz两个定时任务的配置
- Quartz定时任务配置
- Quartz定时任务配置
- Quartz定时任务配置
- spring集成quartz定时任务的配置
- quartz的定时任务
- SpringMVC+Quartz配置定时任务
- Quartz 定时任务 时间配置
- Spring定时任务配置quartz
- quartz 配置 动态定时任务
- spring quartz 定时任务配置
- Quartz定时任务使用配置
- quartz定时任务配置实例
- Spring+Quartz配置定时任务
- Spring配置Quartz定时任务
- Spring+Quartz配置定时任务
- spring quartz配置定时任务
- Spring+Quartz配置定时任务
- LeetCode-714:Best Time to Buy and Sell Stock with Transaction Fee (带有抛售费用的股票最大利润) -- medium
- php判断图片是否显示完全的方式---图片损坏
- LeetCode 86. Partition List
- ArcEngine创建IFeature的三种方法
- dede常用数据库相关命令
- Quartz两个定时任务的配置
- 从 HTTP 到 HTTPS 再到 HSTS
- LeetCode 206. Reverse Linked List && 92. Reverse Linked List II
- 阿里云 CDN HTTPS 最佳实践——OCSP Stapling(四)
- 报错:1130-host ... is not allowed to connect to this MySql server 开放mysql远程连接 不使用localhost
- VS2010+Qt4调试时监视窗口部分类型变量只显示地址不显示值
- 关于MySQL授权
- HTML前端
- HDU5521 Meeting【最短路】