相关疑难解决方法(0)

JSON解析错误:无法构造java.time.LocalDate的实例:no String-argument构造函数/工厂方法从String值反序列化

我是Spring Data REST项目的新手,我正在尝试创建我的第一个RESTful服务.任务很简单,但我被困住了.

我想使用RESTful API对存储在嵌入式数据库中的用户数据执行CRUD操作.

但我无法弄清楚如何使Spring框架处理birthData为"1999-12-15"并将其存储为LocalDate.@JsonFormat注释没有帮助.

目前我收到错误:

HTTP/1.1 400 
Content-Type: application/hal+json;charset=UTF-8
Transfer-Encoding: chunked
Date: Thu, 24 Aug 2017 13:36:51 GMT
Connection: close

{"cause":{"cause":null,"message":"Can not construct instance of java.time.LocalDate: 
no String-argument constructor/factory method to deserialize from String value ('1999-10-10')\n 
at [Source: org.apache.catalina.connector.CoyoteInputStream@4ee2a60e; 
line: 1, column: 65] (through reference chain: ru.zavanton.entities.User[\"birthDate\"])"},
"message":"JSON parse error: Can not construct instance of java.time.LocalDate: 
no String-argument constructor/factory method to deserialize from String value ('1999-10-10'); nested exception is com.fasterxml.jackson.databind.JsonMappingException: 
Can not construct instance of java.time.LocalDate: no String-argument …
Run Code Online (Sandbox Code Playgroud)

rest json jackson spring-data-rest spring-boot

27
推荐指数
6
解决办法
5万
查看次数

标签 统计

jackson ×1

json ×1

rest ×1

spring-boot ×1

spring-data-rest ×1