Skip to content

@Scheduled annotation fixedDelayString attribute does not resolve SpEL expressions [SPR-14114] #18686

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
spring-projects-issues opened this issue Apr 4, 2016 · 2 comments
Assignees
Labels
in: core Issues in core modules (aop, beans, core, context, expression) status: duplicate A duplicate of another issue

Comments

@spring-projects-issues
Copy link
Collaborator

spring-projects-issues commented Apr 4, 2016

Sean Stephenson opened SPR-14114 and commented

I have a @Scheduled method that should execute every N seconds, where N is an interval specified in a config file. Here is how my declaration looks.

@Scheduled(fixedDelayString = "#{${myapp.intervalInSeconds} * 1000}")
public void run() {
// ...
}

Unfortunately, while specifying a property replace expression like "${myapp.intervalInSeconds}" works correctly, using a SpEL expression to convert this to milliseconds does not work. I get the following error message on attempting to start Spring.

Caused by: java.lang.IllegalStateException: Encountered invalid @Scheduled method 'run': Invalid fixedDelayString value "#{10 * 1000}" - cannot parse into integer


Affects: 4.1.7

Issue Links:

@spring-projects-issues
Copy link
Collaborator Author

Juergen Hoeller commented

Fortunately, this has been addressed for 4.3 already and will therefore be included in tomorrow's 4.3 RC1!

@spring-projects-issues
Copy link
Collaborator Author

Sean Stephenson commented

Juergen, thank you very much for the quick response! Cheers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core Issues in core modules (aop, beans, core, context, expression) status: duplicate A duplicate of another issue
Projects
None yet
Development

No branches or pull requests

2 participants