定时任务

@Component
public class Scheduled {
    SimpleDateFormat dateFormat = new SimpleDateFormat("HH:mm:ss");
    
    @Scheduled(cron = "0 0/30 *  * * ? ")   //每隔30分钟执行一次
    public void timerRate() {
        System.out.println(dateFormat.format(new Date()));
      
        //编写 需要定时执行的业务就OK了
        aaa(User);
    }
}

猜你喜欢

转载自www.cnblogs.com/zongheng14/p/9008544.html