Spring简单的定时器

在我们项目配置文件(XML)中配置

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

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

启动task

<task:annotation-driven scheduler="Scheduler"/> 

调用@Scheduled    cron为定时执行的时间

 @Scheduled(cron="0/10 * *  * * ? "

猜你喜欢

转载自blog.csdn.net/qq_25161679/article/details/80622418