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

Make spring use Joda Bean Serialization instead of Jackson #360

Open
mikeyg123 opened this issue Sep 10, 2024 · 0 comments
Open

Make spring use Joda Bean Serialization instead of Jackson #360

mikeyg123 opened this issue Sep 10, 2024 · 0 comments

Comments

@mikeyg123
Copy link

mikeyg123 commented Sep 10, 2024

Hi
The spring default Jackson serialization causes problems with serializing joda beans:

  • it serializes all gettters by default (requiring @JsonIgnore on any additional getters you add)
  • it needs specific constructors or setters for deserialization
  • all super types need to be registered
  • it uses different type hints by default
  • date and time values often get mangled if not set-up correctly
  • just having 2 subtly different serialization formats causes heaps of problems

To fix this the following code replaces jackson serialization for all sub-types of Bean. Works as a spring @component or could be registered with the ObjectMapper etc.
Worth including in the project or documentation?

Many thanks
Mike G

JodaBeanSerializationModule.java.txt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants