今天有個postmapping方法,地址都正確,就是死活進不去,真是奇怪了。
終於從日志中得出些端倪,見下:
只有這個屬性報錯,恰恰這個屬性是Date型。
這句話說得更清楚:
"defaultMessage":"Failed to convert property value of type 'java.lang.String' to required type 'java.util.Date' for property 'expireTime'; nested exception is org.springframework.core.convert.ConversionFailedException: Failed to convert from type [java.lang.String] to type [@com.alibaba.fastjson.annotation.JSONField java.util.Date] for value '2018-06-29'; nested exception is java.lang.IllegalArgumentException",
查找資料,說只要在字段上加上注解:@DateTimeFormat(pattern="yyyy-MM-dd")
加上后就一切OK了。


