Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jackson Serialization for Duration is broken since Spring Boot 2.2 upgrade #19345

Closed
filiphr opened this issue Dec 11, 2019 · 1 comment
Closed
Labels
status: superseded An issue that has been superseded by another type: regression A regression from a previous release

Comments

@filiphr
Copy link
Contributor

filiphr commented Dec 11, 2019

Jackson added a breaking change for the way Duration is serialized. Before The DurationSerializer was using SerializationFeature.WRITE_DATES_AS_TIMESTAMPS to check whether Duration should be serialized as a timestamp or not. Since 2.10 Jackson uses SerializationFeature.WRITE_DURATIONS_AS_TIMESTAMPS to check whether Duration should be serialized as a timestamp or not.

I would suggest that the JacksonAutoConfiguration adds SerializationFeature.WRITE_DURATIONS_AS_TIMESTAMPS with a value false as a default configuration.

This was done in FasterXML/jackson-modules-java8#75

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Dec 11, 2019
@wilkinsona wilkinsona added type: regression A regression from a previous release and removed status: waiting-for-triage An issue we've not yet triaged labels Dec 11, 2019
@wilkinsona wilkinsona added this to the 2.2.x milestone Dec 11, 2019
filiphr added a commit to filiphr/spring-boot that referenced this issue Dec 11, 2019
… default

Jackson added a breaking change in 2.10 for the way Duration is serialized.
Before that the DurationSerializer was using SerializationFeature.WRITE_DATES_AS_TIMESTAMPS
to check whether Duration should be serialized as a timestamp or not.

Since 2.10 Jackson uses SerializationFeature.WRITE_DURATIONS_AS_TIMESTAMPS
to check whether Duration should be serialized as a timestamp or not.

This commit aligns the default for SerializationFeature.WRITE_DURATIONS_AS_TIMESTAMPS
with the default for SerializationFeature.WRITE_DATES_AS_TIMESTAMPS

The change in Jackson was done in FasterXML/jackson-modules-java8#75

fixes spring-projectsgh-19345
@wilkinsona
Copy link
Member

Thanks for the PR, @filiphr. Closing in favour of #19352.

@wilkinsona wilkinsona removed this from the 2.2.x milestone Dec 12, 2019
@snicoll snicoll added the status: superseded An issue that has been superseded by another label Dec 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: superseded An issue that has been superseded by another type: regression A regression from a previous release
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants