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="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");
}