【发布时间】:2022-07-01 21:51:57
【问题描述】:
我遇到了Duration 解析器的问题:
// import java.time.Duration;
...
Duration d = Duration.parse("1h");
...
根据文档,我应该能够使用这个 1h 值,但它给了我以下错误:DateTimeParseException: Text cannot be parsed to a Duration。我从一些配置中检索了1h 值,但为了简单起见,我省略了其他代码。
【问题讨论】:
标签: java spring-boot datetime