According to this documentation, I should be able to use @DurationUnit to change the default unit when converting a duration. However, the example above keeps using MILLISECONDS as the duration unit.
Happening in the latest Spring version
- When not specifying a unit in
application.yml:
- And specifying
DurationUnit to SECONDS in config properties class
@ConstructorBinding
@ConfigurationProperties("myconfig")
class MyProperties(
@DurationUnit(ChronoUnit.SECONDS)
val myDuration: Duration,
)
- Then duration is converted using default
MILLISECONDS unit
myProperties.myDuration.toString() // -> "PT0.07S"