I'm trying to call a rest endpoint which returns a pojo object which looks like this:
public class Process {
@JsonProperty("id")
private String id = null;
@JsonProperty("processDefinitionId")
private String processDefinitionId = null;
@JsonProperty("businessKey")
private String businessKey = null;
@JsonProperty("startedAt")
private OffsetDateTime startedAt = null;
@JsonProperty("endedAt")
private OffsetDateTime endedAt = null;
@JsonProperty("durationInMs")
private Integer durationInMs = null;
@JsonProperty("startActivityDefinitionId")
private String startActivityDefinitionId = null;
@JsonProperty("endActivityDefinitionId")
private String endActivityDefinitionId = null;
@JsonProperty("startUserId")
private String startUserId = null;
@JsonProperty("deleteReason")
private String deleteReason = null;
//constructors and setters+getters
}
Here is the call:
ResponseEntity<Process> responseModel = restTemplate.exchange("http://localhost:8062/processes", HttpMethod.POST, httpEntity, Process.class);
The problem is that i've tried a few methods like ignoring the OffsetDateTime properties or trying to change the format of that date but it will throw this error:
com.fasterxml.jackson.databind.exc.InvalidDefinitionException: Cannot construct instance of `org.threeten.bp.OffsetDateTime` (no Creators, like default construct, exist): no String-argument constructor/factory method to deserialize from String value ('2019-10-04T13:20:29.315Z')
Or it will return null :( What would be a good solution to solve this?