Skip to content

Make spring use Joda Bean Serialization instead of Jackson #360

@mikeyg123

Description

@mikeyg123

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions