-
Notifications
You must be signed in to change notification settings - Fork 40.9k
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
Support flexible duration parsing in placeholders for @Scheduled annotations #15126
Comments
Thanks for the suggestion but it's Spring Framework that parses the In Boot 2.1, the application context's conversion service is configured to be capable of performing |
I've opened https://jira.spring.io/browse/SPR-17481 |
It would be nice to have it supported auto-of-the-box. I was able to reuse Spring Boot's DurationStyle to have more readable configuration properties e.g.:
and then in application configuration yaml I have it configured like this for rate of 25 seconds:
It does look a bit nasty using SpEL in the I'm not sure if there any plans of including / moving |
Thanks for noting the SpEL-based workaround.
As noted above, @manderson23 opened a Framework issue for this: spring-projects/spring-framework#22013. |
I'm not sure what has changed since the report, with Boot 3.7 property defaults without
tests fail to initialize:
but with PT prefix they pass (I'm not sure about correctness of data conversion though, for me enough: tests are passing):
|
@gavenkoa please read the comment above yours. This issue has been marked invalid. |
It's a pity, that this helpful functional is not realized yet.
Why? |
I have a
@ConfigurationProperties
class withDuration
fields. I'd like to reference one of these fields when declaring an annotation like@Scheduled(fixedRateString = "${my-prop.rate}")
.To do this I have to specify the value for the property using the
java.time.Duration
syntax. It would be nice to be able to use the flexible values introduced in #11078.The text was updated successfully, but these errors were encountered: