@SpringBootApplication
@EnableScheduling
public class DemoApplication {
public static void main(String[] args) {
SpringApplication.run(DemoApplication.class, args);
}
}
@Component
public class TestScheduler {
private int count=0;
private static final SimpleDateFormat dateFormat = new SimpleDateFormat("HH:mm:ss");
@Scheduled(initialDelay = 30_000, fixedRate = 10_000)
public void queryReportResult() {
System.out.println("TestScheduler: " + (count++) +" t:"+ dateFormat.format(new Date()));
}
}
关于Cron表达式(转载)
表达式网站生成:
作者:http://blog.csdn.net/supingemail/article/details/22274279
cronExpression定义时间规则,Cron表达