一 背景介绍:页面表单传参,消费者也是表单,生产者json接参
二 失败案例
1.DTO属性上加@JsonSerialize(using = LocalDateTimeSerializer.class)
消费者页面报错: Failed to convert property value of type 'java.lang.String' to required type 'java.time.LocalDateTime' for property 'grantEndTime'; nested exception is org.springframework.core.convert.ConversionFailedException: Failed to convert from type [java.lang.String] to type [@com.fasterxml.jackson.databind.annotation.JsonSerialize @javax.validation.constraints.NotNull java.time.LocalDateTime] for value '2024-03-16 00:00:00'; nested exception is java.lang.IllegalArgumentException: Parse attempt failed for value [2024-03-16 00:00:00]
2.DTO属性上加@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss"),问题同1
3.DTO属性上加 @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")