Cannot deserialize value of type `java.time.LocalDateTime` from String "2022-08-17 00:38:14": Failed to deserialize java.time.LocalDateTime: (java.time.format.DateTimeParseException) Text '2022-08-17 00:38:14' could not be parsed at index 10

在实体中定义时间属性类型为LocalDateTime时,加上时间格式化注解即可

@JsonFormat(shape = JsonFormat.Shape.STRING, pattern="yyyy-MM-dd HH:mm:ss")
Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐