feign服务调用的具体异常信息
Error while extracting response for type [com.xxx.common.core.domain.R<com.xxx.open.api.domain.ClientAuth>] 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 \"2020-09-21 21:49:05\": not a valid representation
(error: Failed to parse Date value '2020-09-21 21:49:05': Cannot parse date \"2020-09-21 21:49:05\": while it seems to fit format 'yyyy-MM-dd'T'HH:mm:ss.SSSX', parsing fails (leniency? null));
nested exception is com.fasterxml.jackson.databind.exc.InvalidFormatException: Cannot deserialize value of type `java.util.Date` from String \"2020-09-21 21:49:05\": not a valid representation
(error: Failed to parse Date value '2020-09-21 21:49:05': Cannot parse date \"2020-09-21 21:49:05\": while it seems to fit format 'yyyy-MM-dd'T'HH:mm:ss.SSSX', parsing fails (leniency? null))\n at
[Source: (PushbackInputStream); line: 1, column: 256] (through reference chain: com.xxx.common.core.domain.R[\"data\"]->com.xxx.open.api.domain.ClientAuth[\"createTime\"])"
这个需要在feign调用的结果里面做转换,不是在原始服务的json做格式转换
最后在date类型字段上面添加这些注解:
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
来源:oschina
链接:https://my.oschina.net/u/1156250/blog/4924341