"ヾ(◍°∇°◍)ノ゙加油哟~","愿我们不负昭华,以梦为马!","愿我们历尽千帆,归来仍是少年!"

Spring Boot定时任务注解demo

import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
@Configuration // 声明类为系统配置类
@EnableScheduling // 开启调度任务
public class Test {
    @Scheduled(cron = "0 0/1 * * * ?") // 定义调度器
    public void job1() {
        System.out.println("this is my first job execute");
    }
}

  

posted @ 2022-03-27 18:44  深夜独行侠  阅读(60)  评论(0编辑  收藏  举报