I am in the process of updating the SpringBoot version to 2.3.1.RELEASE from 2.2.2.RELEASE. Suddenly all date format of all my API responses has changed(In the timezone representation section).
From +0000 to +00:00
"timestamp": "2020-05-19T05:46:49.469+0000" - 2.2.2.RELEASE
"timestamp": "2020-06-30T09:55:23.014+00:00" - 2.3.1.RELEASE
This is my Simple POJO: I have not added any @JsonFortmat configuration for the date field.
@NoArgsConstructor
@AllArgsConstructor
@Getter
public class BuildInfo{
private String message;
private Date timestamp;
}
and my controller method
@GetMapping(value = "/buildinfo", produces = "application/json")
ResponseEntity<BuildInfo> getBuildInfo();
I have not added any serialization/ deserialization logic and I have developed only with SpringBoot's default behavior. I am trying to search any release document regarding this change, but could not find any.
Below changes, I can perform to adapt these changes
Using
@JsonFormatannotation with customized pattern in every date field(but I cannot do it as this is client library)@JsonFormat(pattern="yyyy-MM-dd'T'HH:mm:ss.SSSZ") private Date timestamp;Injecting
Jackson2ObjectMapperBuilderCustomizerin application level.
@Bean
public Jackson2ObjectMapperBuilderCustomizer jsonCustomizer() {
return builder -> builder.simpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ");
}
But I would like to narrow down the root cause for the format change? starting from which version of Jackson/Spring libraries?