springboot 定时任务注解

springboot 最简单的定时任务启动器
1.启动类中加入

  @EnableScheduling

2.在你需要的定时处理的类中加入注解

@Scheduled(cron = "0/5 * * * * *")
@Component
public class DemoTest {
    @Scheduled(cron = "0/5 * * * * *")
    public void start(){
        System.out.println("你的业务执行类");
    }

}

3.最后重启

你可能感兴趣的:(笔记)