Spring boot接收Date时间类型参数 postman传入方式

接收Date类型时不知道该传入什么,然后总是报这样的错

org.springframework.validation.BindException: org.springframework.validation.BeanPropertyBindingResult: 1 errors

Field error in object 'xxx' on field 'beginAt': rejected value [2018-6-24 21:39:58]; codes [typeMismatch.xxx.beginAt,typeMismatch.beginAt,typeMismatch.java.util.Date,typeMismatch]; arguments [org.springframework.context.support.DefaultMessageSourceResolvable: codes [xxx.beginAt,beginAt]; arguments []; default message [beginAt]]; default message [Failed to convert property value of type 'java.lang.String' to required type 'java.util.Date' for property 'beginAt'; nested exception is org.springframework.core.convert.ConversionFailedException: Failed to convert from type [java.lang.String] to type [@com.fasterxml.jackson.databind.annotation.JsonSerialize java.util.Date] for value '2018-6-24 21:39:58'; nested exception is java.lang.IllegalArgumentException]

查了好多资料,终于找到正确的格式了,记录一下

其实很简单,传入 2018/7/7 11:11:00 这种格式就可以了

Spring boot接收Date时间类型参数 postman传入方式_第1张图片


你可能感兴趣的:(Spring boot接收Date时间类型参数 postman传入方式)