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

请注意,本文编写于 3193 天前,最后修改于 178 天前,其中某些信息可能已经过时。

TestTimerTask.java



package cn.joypen.spring.demo3;
import java.util.TimerTask;
/**
 * TimerTask测试
 *
 * @author JOYPEN
 * @email [email protected]
 * @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="cn.joypen.spring.demo3.TestTimerTask">
	
			class="org.springframework.scheduling.timer.ScheduledTimerTask">
		
		
			
			5000
		
		
		
			5000
		
	
	
			class="org.springframework.scheduling.timer.TimerFactoryBean">
		
			
				
			
		
	



TestMain1.java



	public static void main(String[] args) {
		// ApplicationContext ctx = new
		// FileSystemXmlApplicationContext("applicationContext.xml");
		ApplicationContext ctx = new FileSystemXmlApplicationContext("/src/applicationContext.xml");
	}
← 上一篇 下一篇 →
Comments

添加新评论