1. 程式人生 > >Cron做定時任務

Cron做定時任務

這裡我們用到了一個註解@Scheduled

import org.springframework.scheduling.annotation.Scheduled;

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

cron表示式線上生成地址:http://cron.qqe2.com/