Field error in object 'userInfo' on field 'birthday': rejected value [2019-08-07]; codes [typeMismatch.userInfo.birthday,typeMismatch.birthday,typeMismatch.java.time.LocalDateTime,typeMismatch]; arguments [org.springframework.context.support.DefaultMessageSourceResolvable: codes [userInfo.birthday,birthday]; arguments []; default message [birthday]]; default message [Failed to convert property value of type 'java.lang.String' to required type 'java.time.LocalDateTime' for property 'birthday'; nested exception is org.springframework.core.convert.ConversionFailedException: Failed to convert from type [java.lang.String] to type [@org.springframework.format.annotation.DateTimeFormat @io.swagger.annotations.ApiModelProperty java.time.LocalDateTime] for value '2019-08-07'; nested exception is java.lang.IllegalArgumentException: Parse attempt failed for value [2019-08-07]]]
private LocalDateTime birthday;
改成:
@DateTimeFormat(pattern = "yyyy-MM-dd") private Date birthday;