Cron做定时任务

这里我们用到了一个注解@Scheduled

import org.springframework.scheduling.annotation.Scheduled;

    @Scheduled(cron = "0 10 0/1 * * ? ") //每小时一次
    private void SpringTask1() throws Exception{
        //定时执行的方法
    }

cron表达式在线生成地址:http://cron.qqe2.com/

猜你喜欢

转载自blog.csdn.net/AninZz/article/details/84398047
今日推荐