Search code examples
jacksonspring-bootjackson-modules

How to make sure Spring Boot extra Jackson modules are of same version?


Spring Boot already contains the core Jackson dependency + several others.

If you e.g. want to add the org.json or jsr-353 databinding modules you to explicitly define the vesion of these additional modules.

Is there a way to refer to the same version of the other Jackson modules? I want to avoid any compatibility issues.


Solution

  • Spring Boot provides managed dependencies for the following Jackson modules:

    • jackson-annotations
    • jackson-core
    • jackson-databind
    • jackson-datatype-joda
    • jackson-datatype-jsr310

    If you're using maven then additional modules could be defined in your own POM using the ${jackson.version} property. eg:

    <dependency>
        <groupId>com.fasterxml.jackson.datatype</groupId>
        <artifactId>jackson-datatype-whatever</artifactId>
        <version>${jackson.version}</version>
    </dependency>