【发布时间】:2018-07-31 18:58:34
【问题描述】:
当使用带有简单 rest api 的 Spring boot 时,由于某种原因我得到一个错误,它是英文的,像这样:
Failed to convert value of type 'java.lang.String' to required type 'java.util.Date'; nested exception is org.springframework.core.convert.ConversionFailedException: Failed to convert from type [java.lang.String] to type [@org.springframework.web.bind.annotation.RequestParam @org.springframework.format.annotation.DateTimeFormat java.util.Date] for value '2018-07-35'; nested exception is org.joda.time.IllegalFieldValueException: Cannot parse \"2018-07-35\": Value 35 for dayOfMonth must be in the range [1,31]"
是否可以根据请求语言环境翻译所有这些 Spring Boot 消息?
【问题讨论】:
-
i18n 与将字符串转换为日期有什么关系?无论如何,没有一个月有 35 天。
-
请在询问之前阅读错误原因
-
问题不在于邮件内容。问题是关于错误消息的国际化。
标签: java spring spring-boot internationalization