在下面给出的代码中,我得到了编译错误Attribute value must be constant
。如何处理?
@Component
public class ScheduledTasks {
@Value("${example}")
String message;
@Value("${update.rate}")
final static long rate;
@Scheduled(fixedRate = this.rate)
public void update()
{
System.out.println(this.message);
}
}
最佳答案
更改为:
@Scheduled(fixedRateString = "${update.rate}")
public void update()
{
System.out.println(this.message);
}
关于java - 从 application.properties : Attribute value must be constant 读取,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39013894/