spring注解@Scheduled完成定时任务
1.在启动类上添加注解@EnableScheduling
@SpringBootApplication
@EnableScheduling
public class RunApplication {
public static void main(String[] args) throws IOException {
SpringApplication.run(RunApplication.class, args);
}
}
2.在要执行的类上添加注解@Scheduled(cron = "0/
原创
2020-10-30 15:40:06 ·
117 阅读 ·
0 评论