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

你可能感兴趣的:(fegin Google GSON GsonBuilder().setDateFormat("yyyy-MM-dd HH:mm:ss")不能格式化Data)