1

我正在尝试使用此代码在我的域类中设置当前日期

private LocalDate createdUTC = LocalDate.now(Clock.systemUTC());

我没有这个属性只有 getter 的任何 setter。当我通过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的解决方案

4

0 回答 0