错误如下:
"Error while extracting response for type [com.lppz.cic.common.model.ComResult<com.lppz.cic.common.model.dto.product.ProductDetailDto>] and content type [application/json]; nested exception is org.springframework.http.converter.HttpMessageNotReadableException: JSON parse error: Cannot deserialize value of type `java.util.Date` from String \"2021-08-25T16:03:25.884+00:00\": not a valid representation (error: Failed to parse Date value '2021-08-25T16:03:25.884+00:00': Unparseable date: \"2021-08-25T16:03:25.884+00:00\"); nested exception is com.fasterxml.jackson.databind.exc.InvalidFormatException: Cannot deserialize value of type `java.util.Date` from String \"2021-08-25T16:03:25.884+00:00\": not a valid representation (error: Failed to parse Date value '2021-08-25T16:03:25.884+00:00': Unparseable date: \"2021-08-25T16:03:25.884+00:00\")\n at [Source: (PushbackInputStream); line: 1, column: 8611] (through reference chain: com.lppz.cic.common.model.ComResult[\"data\"]->com.lppz.cic.common.model.dto.product.ProductDetailDto[\"scene\"]->com.lppz.cic.common.model.dto.SceneDTO[\"expireAt\"])"
解决方法,在业务model字段上添加注解,然后完美解决。
/**
* 创建时间
*/
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
private Date createTime;
网友评论