SpringMVC 定时任务

在ApplicationContext-mvc.xml 中加入

xmlns:task="http://www.springframework.org/schema/task"
 http://www.springframework.org/schema/task
http://www.springframework.org/schema/task/spring-task-3.2.xsd">

<!-- 设置定时任务 -->
<task:annotation-driven/>

在对应的方法上 写上
@Scheduled(cron = "0 0 1 * * *") // 每天晚上1点开始执行任务
posted @ 2018-09-25 16:38  小小太阳儿  阅读(186)  评论(0编辑  收藏  举报