spring task定时任务

首先在配置文件头部的必须要有:

xmlns:task="http://www.springframework.org/schema/task"

1

其次xsi:schemaLocation必须为其添加:

http://www.springframework.org/schema/task 

http://www.springframework.org/schema/task/spring-task.xsd

1

2

然后spring扫描过程必须涵盖定时任务类所在的目录:

<context:component-scan base-package="com.xx.xx" />

1

扫描二维码关注公众号,回复: 230061 查看本文章

com.xx.xx属于定时任务类的父级甚至更高级 

然后设置动作启用定时任务

<task:annotation-driven/>

1

最后设置任务类

import org.springf

猜你喜欢

转载自zengshaotao.iteye.com/blog/2387177