1.首先加入上篇文章中所需要的jar包
2. xmlns 多加下面的内容、
xmlns:task="http://www.springframework.org/schema/task"
3.xsi:schemaLocation
http://www.springframework.org/schema/task2. xmlns 多加下面的内容、
xmlns:task="http://www.springframework.org/schema/task"
3.xsi:schemaLocation
http://www.springframework.org/schema/task/spring-task-3.1.xsd ;
4.springxml中加入<task:annotation-driven/>
5. 加入<context:component-scan base-package="com.test"/>
6.实现类
@Component
public class ToPtAccountTime{
@Scheduled(cron="0 10-55 17 * * ? ")
public void perform(){ //执行报表统计入口函数
//业务逻辑
System.out.println("开始执行报表的业务逻辑了----现在的时间是--"+new Date());
System.out.println("xxxxxx");
}
}
或者直接 spring.xml <task:scheduled ref="TaskTimer" method="toPtAccountDay" cron="0 * 10 * * ?"/>
5. 加入<context:component-scan base-package="com.test"/>
6.实现类
@Component
public class ToPtAccountTime{
@Scheduled(cron="0 10-55 17 * * ? ")
public void perform(){ //执行报表统计入口函数
//业务逻辑
System.out.println("开始执行报表的业务逻辑了----现在的时间是--"+new Date());
System.out.println("xxxxxx");
}
}
或者直接 spring.xml <task:scheduled ref="TaskTimer" method="toPtAccountDay" cron="0 * 10 * * ?"/>