How to parameterize @Scheduled(fixedDelay) with Spring 3.0 expression language?

Posted by ngeek on Stack Overflow See other posts from Stack Overflow or by ngeek
Published on 2010-04-08T09:19:03Z Indexed on 2010/04/08 9:23 UTC
Read the original article Hit count: 296

When using the Spring 3.0 capability to annotate the a scheduled task, I would like to set the fixedDelay as parameter from my configuration file, instead of hard-wiring it into my task class, like currently...

@Scheduled(fixedDelay=5000)
public void readLog() {
        ...
}

Unfortunately it seems that with the means of the Spring Expression Language (EL) @Value returns a String object which in turn is not able to be auto-boxed to a long value as required by the fixedDelay parameter.

Thanks in advance for your help on this.

© Stack Overflow or respective owner

Related posts about spring

Related posts about annotations