本文介紹在 Spring Boot 中如何使用定時任務,使用非常簡單,就不做過多說明了。
com.kfit.base.scheduling.SchedulingConfig:
package com.kfit.base.scheduling;
importorg.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
importorg.springframework.scheduling.annotation.Scheduled;
/**
- 定時任務
- @author Administrator
*/
@Configuration
@EnableScheduling
public****class SchedulingConfig {
@Scheduled(cron = "0/20 * ** * ?") // 每20秒執行一次
public****void scheduler() {
System. ***out*** .println(">>>>>>>>>SchedulingConfig.scheduler()");
}
}
-
定時
+關注
關注
1文章
124瀏覽量
25906 -
spring
+關注
關注
0文章
340瀏覽量
15061 -
Boot
+關注
關注
0文章
153瀏覽量
36740
發布評論請先 登錄
Spring Boot如何實現異步任務
關于stm32系統定時任務的問題
Linux系統定時任務Crond
busybox用crontab/crond在嵌入式系統中添加定時任務的方法
Spring Boot定時任務的重寫方法
SpringBoot如何實現動態增刪啟停定時任務

評論