在前端传回日期时,后端实体类的接收属性是LocalDateTime类型时.
前端错误:
Failed to convert from type [java.lang.String] to type [@org.springframework.format.annotation.DateTimeFormat @com.fasterxml.jackson.annotation.JsonFormat java.time.LocalDateTime] for value ‘2021-06-01 16:00’
后端错误
[Failed to convert property value of type ‘java.lang.String’ to required type ‘java.time.LocalDateTime’ for property ‘xxxx’;
需要加上在实体属性上加上 @DateTimeFormat(pattern = “yyyy-MM-dd’T’HH:mm:ss.SSS’Z’”)。