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

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。