Springboot 自带定时器

44 阅读1分钟

启动类application,增加注解

@EnableScheduling

方法实现

@Async
@Scheduled( cron = "0 0 1 * * ?") //每天凌晨1点执行一次
public void run() {
   noticeReportService.updateState();
}