spring boot change jackson dependancy version

Viewed 1047

I am using spring boot version 2.3.2.RELEASE. I am using jackson-annotations, jackson-databind, jackson-core, jackson-dataformat-xml with version 2.11.1.

I want to update jackson dependencies to 2.12.4. spring-boot-starter internally uses jackson dependencies. There are two ways I can achieve it

  1. Only change used dependencies (jackson-annotations, jackson-databind, jackson-core, jackson-dataformat-xml) to version 2.12.4 but it will keep other dependencies inside spring-boot-start to 2.11.1. Will it cause any issue if some jackson lib with 2.11.1 and others with 2.12.4?

  2. Change all jackson version using properties

    <jackson.version>2.12.4</jackson.version>
    <jackson-bom.version>2.12.4</jackson-bom.version>
    

    It will update all jackson dependencies to 2.12.4. Will upgrading lib version cause any issue in spring boot framework

Is it better to go with 2nd option?

1 Answers

Defining just <jackson-bom.version>2.12.4</jackson-bom.version> in your POM should be fine usually (you don't need <jackson.version>2.12.4</jackson.version>). Upgrading Spring Boot to the current version (2.5.3 at the time of this writing), which also includes updated Jackson dependencies, would be even better though.

Related