Spring定时任务注解
@Service
@EnableScheduling
public class xxxServiceImpl implement xxxService{@Scheduled(cron = "0 15 11 * * ?") // 每天的11:15执行public void reportCurrentTime() {aaa();}@Scheduled(cron = "0 15 17 * * ?") // 每天的17:15执行public void reportCurrentTime2() {bbb();}@Scheduled(fixedDelay = 500) //运行结束后等待500毫秒执行public void yyy() {}@Scheduled(fixedRate = 500) //间隔500毫秒执行public void yyy2() {}}
spring定时任务@Scheduled注解详解_spring定时任务注解-CSDN博客