Skip to content
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

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

Closed
spring-issuemaster opened this issue Apr 4, 2016 · 2 comments
Assignees

Comments

@spring-issuemaster
Copy link
Collaborator

@spring-issuemaster spring-issuemaster 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:

  • #18203 Support SpEL next to placeholders in annotation attributes (e.g. @Scheduled) ("duplicates")
@spring-issuemaster
Copy link
Collaborator Author

@spring-issuemaster spring-issuemaster commented Apr 4, 2016

Juergen Hoeller commented

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

@spring-issuemaster
Copy link
Collaborator Author

@spring-issuemaster spring-issuemaster commented Apr 4, 2016

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
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.