来自 属性 文件的计划费率
Scheduled Rate from property file
您好,我喜欢从 属性 文件中获取调度程序值,我的 spring 版本是 3.1.2。我无法更新 spring 的版本。 fixedRateString 仅在更高版本 3.2.2 中可用。有什么办法可以从 属性 文件中获取这个值。
@Scheduled(fixedRate = 1000000)
您可以使用 @Scheduled(cron=". . .")
表达式进行任务调度。
If a fixed rate execution is desired, simply change the property name
specified within the annotation. The following would be executed every
5 seconds measured between the successive start times of each
invocation.
@Scheduled(fixedRate=5000)
public void doSomething() {
// something that should execute periodically
}
If simple periodic scheduling is not expressive enough, then a cron
expression may be provided. For example, the following will only
execute on weekdays.
@Scheduled(cron="*/5 * * * * MON-FRI")
public void doSomething() {
// something that should execute on weekdays only
}
spring/docs/3.1.x/spring-framework-reference/html/scheduling.html
您好,我喜欢从 属性 文件中获取调度程序值,我的 spring 版本是 3.1.2。我无法更新 spring 的版本。 fixedRateString 仅在更高版本 3.2.2 中可用。有什么办法可以从 属性 文件中获取这个值。
@Scheduled(fixedRate = 1000000)
您可以使用 @Scheduled(cron=". . .")
表达式进行任务调度。
If a fixed rate execution is desired, simply change the property name specified within the annotation. The following would be executed every 5 seconds measured between the successive start times of each invocation.
@Scheduled(fixedRate=5000)
public void doSomething() {
// something that should execute periodically
}
If simple periodic scheduling is not expressive enough, then a cron expression may be provided. For example, the following will only execute on weekdays.
@Scheduled(cron="*/5 * * * * MON-FRI")
public void doSomething() {
// something that should execute on weekdays only
}
spring/docs/3.1.x/spring-framework-reference/html/scheduling.html