前后端交互时间格式字符串
最近在和vue前端交互时有个string格式的时间字符串一直报一个
"Failed to convert property value of type ‘java.lang.String’ to required type ‘java.util.Date’ for property ‘createTimeEnd’; nested exception is org.springframework.core.convert.ConversionFailedException: Failed to convert from type [java.lang.String] to type [@com.fasterxml.jackson.annotation.JsonFormat java.util.Date] for value ‘2022-02-02 22:22:00’; nested exception is java.lang.IllegalArgumentException
数据库字段类型是timestamp,实体类也使用timestamp接收,正确使用方式如下图,要注意pattern格式一定要正确!!!我就是因为HH:MM:ss耽误了好久