fegin Google GSON GsonBuilder().setDateFormat("yyyy-MM-dd HH:mm:ss")不能格式化Data

參考博客:
https://blog.csdn.net/AJian759447583/article/details/8216956?utm_medium=distribute.pc_relevant.none-task-blog-OPENSEARCH-1&depth_1-utm_source=distribute.pc_relevant.none-task-blog-OPENSEARCH-1

1、報錯如下

{"timestamp":"2020-05-05T00:37:06.600+0000","status":400,"error":"Bad Request","message":"JSON parse error: Cannot deserialize value of type java.util.Date from String "2020-05-05 08:37:06": not a valid representation (error: Failed to parse Date value '2020-05-05 08:37:06': Cannot parse date "2020-05-05 08:37:06": while it seems to fit format 'yyyy-MM-dd'T'HH:mm:ss.SSSZ', parsing fails (leniency? null)); nested exception is com.fasterxml.jackson.databind.exc.InvalidFormatException: Cannot deserialize value of type java.util.Date from String "2020-05-05 08:37:06": not a valid representation (error: Failed to parse Date value '2020-05-05 08:37:06': Cannot parse date "2020-05-05 08:37:06": while it seems to fit format 'yyyy-MM-dd'T'HH:mm:ss.SSSZ', parsing fails (leniency? null))\n at [Source: (PushbackInputStream); line: 7, column: 17] (through reference chain: cetc15.image.entity.SvcDepConf["createTime"])","path":"/image-db/svc-dep-conf/"}

使用的是fegin,


image

2、解決措施

image

3、適配器方式

image

image

最后編輯于
?著作權歸作者所有,轉載或內容合作請聯系作者
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發布,文章內容僅代表作者本人觀點,簡書系信息發布平臺,僅提供信息存儲服務。