springmvc定时任务配置

1.xml配置头中添加

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

2.xml配置文件中添加

<context:property-placeholder />
 <task:annotation-driven />

3.配置定时任务所用到的类

<bean id="xxxService" class="x.xx.xxx.xxxServiceImpl">
 </bean>

4.xxxServiceImpl方法头中添加

@Scheduled(cron = "5 0 0 * * ?")

猜你喜欢

转载自zhglhy.iteye.com/blog/2184794