LocalDate抛出jsonmappingexception

时间:2017-05-29 11:55:27

标签: java resttemplate localdate

我正在尝试使用此代码

在我的域类中设置当前日期
private LocalDate createdUTC = LocalDate.now(Clock.systemUTC());

我没有任何针对此属性的setter只有getter。当我通过 RestTemplate 向我的控制器发送请求时,我收到此错误

{ "responseCode": 500, "responseText": "Could not read document: Can not construct instance of java.time.LocalDateTime: no suitable constructor found, can not deserialize from Object value (missing default constructor or creator, or perhaps need to add/enable type information?)\n at [Source: java.io.PushbackInputStream@6bde8de2; line: 1, column: 352] (through reference OrganizationResponse[\"createdUTC\"]); nested exception is com.fasterxml.jackson.databind.JsonMappingException: Can not construct instance of java.time.LocalDateTime: no suitable constructor found, can not deserialize from Object value (missing default constructor or creator, or perhaps need to add/enable type information?)\n at [Source: java.io.PushbackInputStream@6bde8de2; line: 1, column: 352] (through reference chain: OrganizationResponse[\"createdUTC\"])" }

到目前为止,我所尝试的是来自thisthis

的解决方案

0 个答案:

没有答案