设为首页 加入收藏

TOP

maven构建使用Spring执行定时任务
2014-11-24 01:40:35 来源: 作者: 【 】 浏览:1
Tags:maven 构建 使用 Spring 执行 定时 任务

maven构建使用Spring执行定时任务


首先,pom.xml中加入依赖:


版本配置信息:



1.6
3.1.1.RELEASE
2.2.1
1.6.10
1.6.6


依赖:



org.springframework
spring-context
${org.springframework-version}



commons-logging
commons-logging


commons-beanutils
commons-beanutils


commons-digester
commons-digester




org.springframework
spring-context-support
${org.springframework-version}


org.springframework
spring-tx
${org.springframework-version}


org.springframework
spring-web
${org.springframework-version}


org.quartz-scheduler
quartz
1.8.5




org.springframework
spring-webmvc
${org.springframework-version}



org.aspectj
aspectjrt
${org.aspectj-version}


java代码:


package com.cetc.yun.service.impl;


import org.apache.log4j.Logger;


import com.cetc.yun.service.TaskTestService;


public class TaskTestServiceImpl implements TaskTestService {


private static Logger log = Logger.getLogger(TaskTestServiceImpl.class);


@Override
public void sayHello() {
// TODO Auto-generated method stub
try {
log.info("处理任务开始>........");
// 业务逻辑代码调用
log.info("时间[" + new java.util.Date().toGMTString()
+ "]----->大家好啊!");
log.info("处理任务结束!");
} catch (Exception e) {
log.error("处理任务出现异常", e);
}
}


}


关键配置信息:


< xml version="1.0" encoding="UTF-8" >
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:task="http://www.springframework.org/schema/task"
xmlns:beans="http://www.springframework.org/schema/mvc"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/task
http://www.springframework.org/schema/task/spring-task-3.1.xsd">







sayHello







0/5 * 08-21 * *












相关阅读


】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇shell 告警脚本 下一篇通过maven添加Quartz

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容: