【问题标题】:Using schedule task(@schedule) in spring在春季使用计划任务(@schedule)
【发布时间】:2016-03-09 10:51:07
【问题描述】:

您好,我正在处理一项 cron 作业,并希望将任务安排为每 2 分钟运行一次,问题是它在 1 分钟 20 秒左右开始,而不是 2 分钟。这是我的 cron 计划

  @scheduled
  (cron="${followed_forum_task_
  crown_expression} ")

然后在我的 application.property 文件中

  followed_forum_task_
  crown_expression = 0 0/2 * * * ?

【问题讨论】:

    标签: spring spring-boot scheduled-tasks


    【解决方案1】:

    你可以使用

    @Scheduled(fixedDelay = 0, fixedRate = 2*1000*60)

    而不是 cron 表达式。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-03-06
      • 1970-01-01
      • 1970-01-01
      • 2012-06-23
      • 2018-02-28
      • 2019-05-18
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多