报错信息
Failed to convert value of type 'java.lang.String' to required type 'java.util.Date'; nested exception is org.springframework.core.convert.ConversionFailedException: Failed to convert from type [java.lang.String] to type [java.util.Date] for value [2021-05-28 16:28:21]; nested exception is java.lang.IllegalArgumentException
解决办法,加上此注解
DateTimeFormat 前端往后端传数据
@DateTimeFormat(pattern=“yyyy-MM-dd HH:mm:ss”)
另外 JsonFormat 用于,后端返回数据到前端
@JsonFormat(pattern="yyyy-MM-dd",timezone = "GMT+8")