我是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)