Spring @Scheduled inject delay time
java, quartz-scheduler, spring
Solution
I got stuck on the same issues but the best way to solve this now would be:
@Scheduled(fixedDelayString = "${my.delay.property}")
public void myScheduledMethod(){
// do something
}
Problem
I have a few methods annotated with ``` @Scheduled(fixedDelay = 6000) private void myScheduledMethod(){ //do something } ``` I also have a set of properties files where I configure environment specific values. For testing purposes I'd like the value of the delay to be configurable, ideally through a property in a properties file. Since the value of `fixedDelay` has to be a constant, I'm looking for a way to get this set from a properties file, but haven't found a way to do it yet.