网站首页

人工智能P2P分享搜索全网发布信息网站地图标签大全

当前位置:诺佳网 > 电子/半导体 > 嵌入式技术 >

在Spring Boot中如何使用定时任务

时间:2023-04-12 10:56

人气:

作者:admin

标签: 定时  Boot  Spring 

导读:本文介绍在 Spring Boot 中如何使用定时任务,使用非常简单,就不做过多说明了。...

本文介绍在 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()");

}

}

温馨提示:以上内容整理于网络,仅供参考,如果对您有帮助,留下您的阅读感言吧!
相关阅读
本类排行
相关标签
本类推荐

CPU | 内存 | 硬盘 | 显卡 | 显示器 | 主板 | 电源 | 键鼠 | 网站地图

Copyright © 2025-2035 诺佳网 版权所有 备案号:赣ICP备2025066733号
本站资料均来源互联网收集整理,作品版权归作者所有,如果侵犯了您的版权,请跟我们联系。

关注微信