<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
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.xsd
http://www.springframework.org/schema/task
http://www.springframework.org/schema/task/spring-task.xsd">
<task:scheduler id="taskScheduler" pool-size="20"/>
<task:scheduled-tasks scheduler="taskScheduler">
<task:scheduled ref="taskTest" method="test1" cron="0/1 * * * * ?"/>
</task:scheduled-tasks>
</beans>
----------------------------------分割线--------------------------------
@Component
public class TaskTest {
public void test1() {
System.out.println(new Date());
}
}