spring定时器小结【1】-TimeTask的实现

2010-07-22 439 0

TestTimerTask.java


package cn.joypen.spring.demo3;
import java.util.TimerTask;
/**

  • TimerTask测试

  • @author JOYPEN

  • @email user.zhaopeng@qq.com

  • @webSite htt://joypen.cn

  • @time 2010-7-22 下午07:26:21
    */
    public class TestTimerTask extends TimerTask {
    @Override
    public void run() {
    System.out.println("enter TimerTask !");
    }
    }


applicationContext.xml


< ?xml version="1.0" encoding="UTF-8"?>
< !DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "spring-beans.dtd" >

     class=&quot;cn.joypen.spring.demo3.TestTimerTask&quot;&gt;     class=&quot;org.springframework.scheduling.timer.ScheduledTimerTask&quot;&gt;     5000     5000     class=&quot;org.springframework.scheduling.timer.TimerFactoryBean&quot;&gt;


TestMain1.java


public static void main(String[] args) {
// ApplicationContext ctx = new
// FileSystemXmlApplicationContext("applicationContext.xml");
ApplicationContext ctx = new FileSystemXmlApplicationContext("/src/applicationContext.xml");
}

相关文章

15年来的手艺之路:手艺人赵鹏的自述
纪念 Google 25 周年:从搜索引擎到科技巨头的演变之路
1小时编写一个支持七牛上传的 markdown 客户端3(打包发布篇)
1小时编写一个支持七牛上传的 markdown 客户端2(代码优化篇)
1小时编写一个支持七牛上传的 markdown 客户端1(技术实现篇)
从 wordpress 转移到 hexo

Leave a Reply