如何在运行时更改Spring的@Scheduled fixedDelay [英] How to change Spring's @Scheduled fixedDelay at runtime

查看:1197
本文介绍了如何在运行时更改Spring的@Scheduled fixedDelay的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要以固定的时间间隔运行批处理作业,并且能够在运行时更改此批处理作业的时间。为此,我遇到了Spring框架下提供的@Scheduled注释。但我不确定如何在运行时更改fixedDelay的值。我做了一些谷歌搜索,但没有发现任何有用的东西。

I have a requirement to run a batch job at a fixed interval and have the ability to change the time of this batch job at runtime. For this I came across @Scheduled annotation provided under Spring framework. But I'm not sure how I'd change the value of fixedDelay at runtime. I did some googling around but didn't find anything useful.

推荐答案

你可以使用触发器动态设置下一个执行时间。请在此处查看我的答案:

You can use a Trigger to dynamically set the next execution time. See my answer here:

以编程方式使用Spring安排作业(动态设置fixedRate)

这篇关于如何在运行时更改Spring的@Scheduled fixedDelay的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆