XML file
<?xml version= "1.0" encoding= "UTF-8"?>
<beans xmlns= "Http://www.springframework.org/schema/beans"
xmlns:context= "Http://www.springframework.org/schema/context"
Xmlns:xsi= "Http://www.w3.org/2001/XMLSchema-instance"
xmlns:task= "Http://www.springframework.org/schema/task"
Xsi:schemalocation= "Http://www.springframework.org/schema/beans
Http://www.springframework.org/schema/beans/spring-beans-3.0.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.0.xsd ">
<task:annotation-driven/> <!--timer Switch--
<bean id= "Talkcontroller" class= "Cn.springmvc.talk.TalkController" ></bean>
<task:scheduled-tasks>
<!--
This represents the execution every five seconds.
-
<task:scheduled ref= "Talkcontroller" method= "Talktest" cron= "*/5 * * * * *?"/>
</task:scheduled-tasks>
<!--automatically scanned package name--
<context:component-scan base-package= "Cn.springmvc.talk"/>
</beans>
Java files
Package cn.springmvc.talk;
public class Talkcontroller {
public void Talktest () {
System.out.println ("task Start");
}
}
Spring Talk Simple Configuration