spring 计时器

spring 计时器

可以这样:

http://blog.csdn.net/u010648555/article/details/52162840

也可以使用annotation

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

@Service
@Lazy(value=false)
public class TaskWeixin {
    
    
    // @Scheduled(cron = "*/5 * * * * ?") // 每5秒处理一次
    @Scheduled(cron = "0 */60 * * * ?") // 1小时处理一次
    public void schedule(){
        
          System.out.println("calc the user list");
        
        } 
}
原文地址:https://www.cnblogs.com/stono/p/6557724.html