Skip to content

Support Spring Boot style flexible Duration value parsing [SPR-17481] #22013

Closed as not planned
@spring-projects-issues

Description

@spring-projects-issues

manderson23 opened SPR-17481 and commented

Spring Boot supports specifying duration values in property files using values such as 15ms, 10s etc. (See spring-projects/spring-boot#11078).

However, this means that there are inconsistencies when trying to use the values of these properties with Spring Framework annotations. An example was provided in spring-projects/spring-boot#15126 where I would like to use a property value in a Scheduled annotation e.g.

@Scheduled(fixedRateString = "${my-prop.rate}")

In this case I have to specify the property value using java.time.Duration syntax instead of the Spring Boot flexible syntax as ScheduledAnnotationBeanPostProcessor is hardcoded to use java.time.Duration parsing.

It would be good if Spring Framework also supported the flexible syntax to allow consistent property values to be used.


Affects: 5.1.2

Metadata

Metadata

Assignees

Labels

in: coreIssues in core modules (aop, beans, core, context, expression)status: supersededAn issue that has been superseded by anothertype: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions