The deserialization is failing after the update.
I updated my micro-service from Spring 1.5.10.RELEASE to Spring 2.0.3.RELEASE
You want to deserialize a class which has final field. so u need to declare a constructor which contains final field to deserialize.
@Data
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
public class ErrorDetail {
private final String heading;
private final String detail;
private String type;
@JsonCreator
public ErrorDetail(@JsonProperty("heading") String heading, @JsonProperty("detail") String detail) {
this.heading = heading;
this.detail = detail;
}
}
and when deserialize with mapper need to MapperFeature.ALLOW_FINAL_FIELDS_AS_MUTATORS set this property false.
private static T asObject(final String str, Class clazz) {
try {
return new ObjectMapper().configure(MapperFeature.ALLOW_FINAL_FIELDS_AS_MUTATORS,false).readValue(str, clazz);
} catch (Exception e) {
throw new RuntimeException(e);
}
}