I have Spring 4.1 Application
. I am trying to schedule based on value from property file. I have read this post. But I do not want the following way of EL inside @Scheduled
@Scheduled(fixedDelayString = "${my.fixed.delay.prop}")
public void readLog() {
...
}
Here is my class.
public class MyService {
@Value("${timerInMilliSeconds: 60000}")
private long timerinMilliSeconds;
public myService(){
}
@Scheduled(fixedRate = timerinMilliSeconds)
public void myTimer() {
//do stuff
}
}
I get this error.
The value for annotation attribute Scheduled.fixedRate must be a constant
expression