springboot定时任务(简单实现)

﹏ヽ暗。殇╰゛Y 2023-01-10 10:21 296阅读 0赞
  1. import org.springframework.context.annotation.Configuration;
  2. import org.springframework.scheduling.annotation.EnableScheduling;
  3. import org.springframework.scheduling.annotation.Scheduled;
  4. @Configuration
  5. @EnableScheduling
  6. public class TestTask {
  7. @Scheduled(cron = "0 0/1 * * * ?")
  8. public void TestTask() {
  9. //业务代码实现
  10. }
  11. }

发表评论

表情:
评论列表 (有 0 条评论,296人围观)

还没有评论,来说两句吧...

相关阅读

    相关 springboot定时任务实现

    一、springboot定时任务实现——方式1 在项目开发中,经常需要定时任务来帮助我们来做一些内容,比如定时发送短息/站内信、数据汇总统计、业务监控等。 1、启动类