Support multiple parsing patterns in @DateTimeFormat
Prior to this commit, @DateTimeFormat only supported a single format for parsing date time values via the style, iso, and pattern attributes. This commit introduces a new fallbackPatterns attribute that can be used to configure multiple fallback patterns for parsing date time values. This allows applications to accept multiple input formats for date time values. For example, if you wish to use the ISO date format for parsing and printing but allow for lenient parsing of user input for various additional date formats, you could annotate a field or method parameter with configuration similar to the following. @DateTimeFormat( iso = ISO.DATE, fallbackPatterns = { "M/d/yy", "dd.MM.yyyy" } ) Closes gh-20292
Showing
想要评论请 注册 或 登录