SringBoot_7_定时器

import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;

@Configuration
@EnableScheduling
public class SchedulingConfig{
    @Scheduled(cron = "0/20 * * * * ?") // 每20秒执行一次
    public void scheduler() {
         System.out.println(">>>>>>>>> SchedulingConfig.scheduler()");
    }
}

你可能感兴趣的:(SringBoot_7_定时器)