Springboot解析前端传来的JSON报错
JSON parse error: Cannot deserialize value of type `java.util.Date` from String "2022/6/21 8:37": expected format "yyyy-MM-dd HH:mm:ss"; nested exception is com.fasterxml.jackson.databind.exc.InvalidFormatException: Cannot deserialize value of type `java.util.Date` from String "2022/6/21 8:37": expected format "yyyy-MM-dd HH:mm:ss"
at [Source: (org.springframework.util.StreamUtils$NonClosingInputStream); line: 9, column: 17] (through reference chain: com.wuxianggujun.wuxiangblog.entity.User["createTime"])
使用
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern="yyyy-MM-dd HH:mm:ss")
就解决了,百度的其他文章没有什么用,不知道为什么