We upgraded lately from Spring Boot 2.1.9 to 2.2.1 which caused our tests to fail. Investigation led to the result that the java.time.Duration
type is now serialized differently by default. Instead of having the String "PT15M"
in the JSON message we now get "900.0"
. The POJO definition looks like that
@JsonProperty(required = true, value = "duration")
@NotNull
private final Duration duration;
The question now is if there is some configuration property we can use to get the "old" behavior. I know we could also add annotation
@JsonFormat(shape = JsonFormat.Shape.STRING)
but I would prefer a way to have it just by configuration.