Field error in object 'studyProjectInfo' on field 'createTime' : rejected value [2026-03-03T15:42]; codes [typeMismatch.studyProjectInfo.createTime,typeMismatch.createTime,typeMismatch.java.util.Date,typeMismatch]; arguments [org.springframework.context.support.DefaultMessageSourceResolvable: codes [studyProjectInfo.createTime,createTime]; arguments []; default message [createTime]]; default message [Failed to convert property value of type 'java.lang.String' to required type 'java.util.Date' for property 'createTime'; nested exception is java.lang.IllegalArgumentException: Date format is not supported [2026-03-03T15:42].]
Field error in object 'studyProjectInfo' on field 'updateTime' : rejected value [,2026-03-05T16:45]; codes [typeMismatch.studyProjectInfo.updateTime,typeMismatch.updateTime,typeMismatch.java.util.Date,typeMismatch]; arguments [org.springframework.context.support.DefaultMessageSourceResolvable: codes [studyProjectInfo.updateTime,updateTime]; arguments []; default message [updateTime]]; default message [Failed to convert property value of type 'java.lang.String[]' to required type 'java.util.Date' for property 'updateTime'; nested exception is java.lang.IllegalArgumentException: Date format is not supported [,2026-03-05T16:45].]
at org.springframework.web.method.annotation.ModelAttributeMethodProcessor.resolveArgument(ModelAttributeMethodProcessor.java:115) | admin | http-nio-8080-exec-7 | com.joyintech.platform.adivice.BasePackageAdvice.logErrorInfo(BasePackageAdvice.java:76)
DEBUG 15:43:45.942 | Executing sql insert:
INSERT INTO SYS_ERROR_LOG(ID,HOST_CODE,THREAD_CODE,ERROR_CLASS,ERROR_MESSAGE,ERROR_TRACES,ERROR_TIME,OPERATE_USER,CREATE_TIME)
时间转换问题 使用注解或者配置类转换
似乎有两处错误,
第一处createTime接到的值是【2026-03-03T15:42】,字符串向Date类转换失败。
第二处updateTime接到的值是【,2026-03-05T16:45】,先不说转换问题,最前面多了个逗号肯定是不行的。
试一下这种
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
//2022-03-22T18:32
@DateTimeFormat(pattern = "yyyy-MM-dd'T'HH:mm")
private Date createTime;