报错如下:
HttpMessageNotReadableException: JSON parse error: Cannot deserialize value of type java.util.Date
from String "2023/3/21 23:35:36": expected format "yyyy-MM-dd HH:mm:ss"; nested exception is com.fasterxml.jackson.databind.exc.InvalidFormatException
前端是通过下面的代码获取时间的:
const now = new Date();
this.Form.mtime = now.toLocaleString();
后端放了这个:
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern="yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date mtime;