定时调度

Springboot定时调度

1 方法一

只是说是 fixedRate 任务两次执行时间间隔是任务的开始点,而 fixedDelay 的间隔是前次任务的结束与下次任务的开始。

@Configuration
@EnableScheduling
public class SchedulingConfig {

    @Autowired XXX xxx
    @Scheduled(fixedRate = 10000)
    public void test() throws InterruptedException {
        Thread.sleep(3000);
        System.out.println("定时调度rate。。。。。。。。。");
    }

    @Scheduled(fixedDelay = 10000)
    public void test2(){
        System.out.println("delays。。。。。。。。。");
    }


}

方法二:

猜你喜欢

转载自blog.csdn.net/xinjianwuhen1991/article/details/81514540