{
"created_date": "2021-04-06 18:46:24",
...
"needed_date": "2021-04-06 18:46:24"
}

传到数据库之后时间为:'2021-04-07 02:46:24'

数据库中时间推迟了8小时

解决方案

@JsonFormat(shape = JsonFormat.Shape.STRING, pattern="yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@JsonProperty("needed_date")
private Timestamp neededDate;

@JsonFormat(shape = JsonFormat.Shape.STRING, pattern="yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@JsonProperty("created_date")
private Timestamp createdDate;

增加 timezone = "GMT+8",再次插入数据时,时间可以正常显示。'2021-04-06 18:46:24'