spring任务调度配置
来源:互联网 发布:php socket 编辑:程序博客网 时间:2024/05/21 17:14
1.准备jar包:quartz-1.8.5.jar
commons-logging.jar
spring-core-3.0.5.RELEASE.jar
spring-beans-3.0.5.RELEASE.jar
spring-context-3.0.5.RELEASE.jar
spring-context-support-3.0.5.RELEASE.jar
spring-asm-3.0.5.RELEASE.jar
spring-expression-3.0.5.RELEASE.jar
spring.transaction-3.0.5.RELEASE.jar
spring-web-3.0.5.RELEASE.jar
2.配置web.xml---ssh通用配置
3.配置spring ----applicationContext.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:mvc="http://www.springframework.org/schema/mvc"xmlns:context="http://www.springframework.org/schema/context"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-3.0.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-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/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"><!--调度任务开始 --> <!-- 要调用的工作类 --> <bean id="myJob" class="com.task.Task" /> <!-- job的配置开始 --> <bean id="myJobDetail" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean"> <property name="targetObject"> <ref bean="myJob" /> </property> <property name="targetMethod"> <value>work</value> </property> </bean> <!-- job的配置结束 --> <!-- 调度的配置开始 --> <bean id="crontestJobTrigger" class="org.springframework.scheduling.quartz.CronTriggerBean"> <property name="jobDetail"> <ref bean="myJobDetail" /> </property> <property name="cronExpression"> <value>0/1 * * * * ?</value> </property> </bean> <!-- 调度的配置结束 --> <!-- 启动触发器的配置开始 --> <bean name="startQuertz" lazy-init="false" autowire="no" class="org.springframework.scheduling.quartz.SchedulerFactoryBean"> <property name="triggers"> <list> <ref bean="crontestJobTrigger" /> </list> </property> </bean> <!-- 启动触发器的配置结束 --><!-- 调度任务结束 --></beans>4.编写任务调度代码:
package com.task;import java.util.Date;public class Task {public void work() { System.out.println("当前时间:"+new Date().toString()); }}5.启动tomcat,即可在Console窗口看到输出
阅读全文
0 0
- Spring任务调度配置
- spring任务调度配置
- Spring配置Quartz任务调度
- Spring配置Quartz任务调度
- spring配置定时调度任务
- Spring配置quartz调度任务
- Spring 配置Quartz 定时任务调度服务
- Spring中任务调度cronExpression配置说明
- Spring中Quartz任务调度的配置
- Spring中任务调度cronExpression配置说明
- Spring配置Quartz任务调度框架教程
- spring任务调度器quartz 时间配置
- Spring配置Quartz任务调度框架教程
- Spring配置quartz定时调度任务
- Spring配置Quartz任务调度框架教程
- Spring--Quartz 任务调度的配置详解
- Spring中任务调度cronExpression配置说明
- Spring 任务调度配置及使用
- 目前大家对Python都有一个共识,就是他对测试非常有用,自动化测试里Python用途也很广,但是Python到底怎么进行自动化测试呢?今天就简单的向大家介绍一下怎么使用Python进行自动化测试
- iOS runtime实战应用:成员变量和属性
- 使用AFNetworking进行图片上传
- 用户访问网站流程以及基本原理
- Java语言设计模式之生成器(Builder)
- spring任务调度配置
- 队列-C语言实现-适用各种数据类型
- Error:(3, 34) 错误: 程序包android.support.annotation不存在
- ubantu 下python调用opencv的cv2读取图片发生错误
- 加多芬专注于移动支付系统开发
- STM32学习笔记:读写内部Flash。
- Mybatis 中$与#的区别
- Trafodion Troubleshooting-org.apache.zookeeper.KeeperException$NoNodeException
- Windows下编译 openh264 小记