spring-framework
spring-framework copied to clipboard
Add utility to parse Duration from a String
It would make sense to have a common utility to parse java.time.Duration from a CharSequence.
Examples:
-
10ms-> 10 milliseconds -
10s-> 10 seconds -
10m-> 10 minutes -
10h-> 10 hours
ChronoUnits to support:
- Nanos
- Micros
- Millis
- Seconds
- Minutes
- Hours
- Days
Spring Boot provides this functionality and we'd like to reuse it in Spring Data.
Relates to #22013
Team Decision: We can do this in fallback mode, trying the built-in Duration formatting, and then falling back on alternative formats, in effect extending the built-in one. We should ensure the spec of what Boot supports already, works in the new arrangement.
linked to #22013 and superseded by gh-30396