0
我有Spring 4.1 Application
。我正在嘗試根據屬性文件的值進行計劃。我已閱讀此post。但我不希望裏面@Scheduled
在彈簧4.1應用程序中使用@Scheduled參數時出錯
@Scheduled(fixedDelayString = "${my.fixed.delay.prop}")
public void readLog() {
...
}
這裏是我的課EL下列方式。
public class MyService {
@Value("${timerInMilliSeconds: 60000}")
private long timerinMilliSeconds;
public myService(){
}
@Scheduled(fixedRate = timerinMilliSeconds)
public void myTimer() {
//do stuff
}
}
我得到這個錯誤。
The value for annotation attribute Scheduled.fixedRate must be a constant expression