Spring Quartz定时调度任务配置
2016-01-13 14:10
585 查看
applicationContext-quartz.xml定时调度任务启动代码:
<!-- 在spring appcontext中引入后定时调度才会有效 -->
<import resource="classpath:applicationContext-quartz.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:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd" default-lazy-init="false"> <bean id="scheduleInfoManager" class="com.web.scheduler.util.QuartzJobFactory"> <property name="scheduler" ref="schedulerFactory" /> <property name="jobService"></property> </bean> <bean id="schedulerJobDetail" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean"> <property name="group" value="job_work"/> <property name="name" value="job_work_name"/> <property name="targetObject" ref="scheduleInfoManager"/> <property name="targetMethod" value="execute"/> <property name="concurrent" value="false"/> </bean> <bean id="cronTrigger" class="org.springframework.scheduling.quartz.CronTriggerFactoryBean "> <property name="name" value="work_default_name"/> <property name="group" value="work_default"/> <property name="jobDetail" ref="schedulerJobDetail" /> <property name="cronExpression"> <value>0 0 2 * * ?</value> </property> </bean> <bean id="schedulerFactory" class="org.springframework.scheduling.quartz.SchedulerFactoryBean"> <property name="triggers"> <list> <ref bean="cronTrigger" /> </list> </property> </bean> </beans>
<!-- 在spring appcontext中引入后定时调度才会有效 -->
<import resource="classpath:applicationContext-quartz.xml" />
相关文章推荐
- java:IO流学习小结
- Java IO流分析整理
- 把Java的class文件转为EXE文件的八种方法
- Java IO最详解
- Java之美[从菜鸟到高手演变]之Java中的IO
- java中byte数组与int类型的转换(两种方式)
- java判断""和null的方法
- Java的native关键字
- java中byte数组与int类型的转换(两种方式)
- Java解析XMl
- java 实现二分查找法
- eclipse-mvn打包跳过junit测试类
- Mac下如何安装JDK
- 在eclipse开发工具中使用JUnit4进行单元测试详解(一)入门篇
- Java Web(10)在Ubuntu 15.10 下安装mysql设置数据库编码
- java基本类型的长度
- java 生存32位的MD5码
- java中的@Override是否需要
- 5.java成长之路——重读java编程思想05
- spring 定时任务执行两次 解决方案