无效的 fixedDelayString 值“${status.schedule}”- 无法解析为 long

问题描述 投票:0回答:0

我有一个我想配置的调度程序,所以我使用 fixeddelaystring 并从 MySQL DB 中获取它的值。但我收到这个错误

Initialization of bean failed; nested exception is java.lang.IllegalStateException: Encountered invalid @Scheduled method 'syncStatusScheduler': Invalid fixedDelayString value "${status.schedule}" - cannot parse into long

调度器

@Scheduled(fixedDelayString = "${status.schedule}" , initialDelay = 1000)
    public void syncStatusScheduler() throws IOException{
.
.
.
}

这是数据库中的行,我想从中获取 fixeddelaystring 的时间

键值
'status.schedule','300000'

除了 fixedDelayString 来选择值,而是得到错误。

java mysql spring-boot error-handling spring-scheduled
© www.soinside.com 2019 - 2024. All rights reserved.