spring boot pom ignoring updated property version - spring-boot

We are currently using spring boot 2.7.4 and we want to use a built in dependency of 2.7.5. I added it to the properties in the pom, but its being ignored. I have done this successfully with other dependencies.
jackson-databind 2.13.4 is a builtin dependency of spring boot 2.7.4
jackson-databind 2.13.4.2 is a dependency of spring boot 2.7.5
<jackson-databind.version>2.13.4.2</jackson-databind.version>
That does not seem to work.
Will spring just ignore an incompatible version automatically ?

Spring boot does not have jackson-databind.version variable. Full list can be seen here
But you can manually specify the required dependency version:
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.13.4.2</version>
<scope>compile</scope>
</dependency>

You need to use jackson-bom.version to override via the property.
From the spring-boot-dependencies POM, which is inherited by the spring-boot-starter-parent the following is defeined in 2.7.5,
<dependency>
<groupId>com.fasterxml.jackson</groupId>
<artifactId>jackson-bom</artifactId>
<version>${jackson-bom.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
and and the property is set to <jackson-bom.version>2.13.4.20221013</jackson-bom.version>

Related

What is Spring boot 2.5 junit version?

I am using latest version of spring boot. What is spring boot 2.5.4 junit version?
spring-boot-starter-test
And for use Junit5 we should addd jupiter dependency in spring boot 2.5.4?
On the mvnrepository.com you will find it:
org.junit.jupiter ยป junit-jupiter
Version
5.7.2
There you can also click on pom.xml to show the dependency in question:
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>5.7.2</version>
<scope>compile</scope>
</dependency>

Problem with upgrading of libraries (spring) in JAVA

My project contains a lot libraries and I want update following:
spring from 5.0.10.RELASE to 5.3.18 or higher
spring-content
spring-core
spring-beans
spring-aop
spring-context-support
spring-orm
spring-jdb
spring-web
spring-webmvc
spring-tx
spring-data-jpa from to 2.3.2 or higher
spring-data-commons from to 2.3.2 or higher
But when I changed version my project durring start has a many errors.
How can I check that these verions libraires are compatible with other (hibernate, log4j etc..)
remove all version tags of spring in your pom and create a dependency management as following:
<dependencyManagement>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring</artifactId>
<version>5.2.9.RELEASE</version>
<type>pom</type>
</dependency>
</dependencyManagement>

Overriding managed versions in maven

I have this dependency in my pom.xml
<!-- Spring Security -->
<dependency>
<groupId>org.thymeleaf.extras</groupId>
<artifactId>thymeleaf-extras-springsecurity4</artifactId>
<version>3.0.2.RELEASE</version>
</dependency>
and this warning in the file: Overriding managed version 2.1.3.RELEASE for thymeleaf-extras-springsecurity4
I wonder is it is better to remove the version number
Generally you shouldn't override the parent versions of spring dependencies.
https://spring.io/blog/2016/04/13/overriding-dependency-versions-with-spring-boot

My Jersey Spring Boot 1.5.2 project doesn't recognize FormDataMultiPart

I tried to add FormDataMultiPart to my Jersey Spring Boot project. I am using Spring Boot 1.5.2 and the Spring Boot Jersey Starter.
I tried adding the full import org.glassfish.jersey.media.multipart.FormDataMultiPart, but it is not found.
It looks like spring-boot-starter-jersey Maven dependency does not include jersey-media-multipart. You need to add it to your pom.xml. On the other hand, Spring Boot does define a jersey.version property so you can use that to keep the versions in sync.
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jersey</artifactId>
</dependency>
<!-- Multipart not included in Spring Boot. jersey.version defined by Spring Boot. -->
<dependency>
<groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-multipart</artifactId>
<version>${jersey.version}</version>
</dependency>
Once you add the jersey-media-multipart dependency to Maven, the FormDataMultiPart class can be found.

Spring Boot with Spring HATEOAS Maven conflicts

It seems when I add the dependency for the spring-hateoas
<groupId>org.springframework.hateoas</groupId>
<artifactId>spring-hateoas</artifactId>
<version>0.13.0.RELEASE</version>
The Class below is no longer available on the classpath
org.springframework.web.bind.annotation.RestController;
I have tried to exclude various dependencies for the spring-hateoas but the APP no longer runs.
Has anyone had any luck running spring-hateoas within spring boot.
Absolutely no problem whatsoever. The #RestController annotation is still available and you shouldn't need to do any exclusion.
In case it helps, I'm currently using version 1.0.2 of Spring Boot:
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.0.2.RELEASE</version>
</parent>
spring-boot-starter-web provides the #RestController:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
I don't define an explicit version for spring-hateoas in my pom.xml, but my build is pulling in 0.9.0.RELEASE:
<dependency>
<groupId>org.springframework.hateoas</groupId>
<artifactId>spring-hateoas</artifactId>
</dependency>
As a side note, I can see from the Eclipse POM editor, that Spring HATEOAS is defining dependencies on Spring 3.2.7. However the spring-boot-starter-parent project manages the versions up to 4.0.3. Can you see what version of Spring you are getting? Have you perhaps not used the spring-boot-parent as a parent project?

Resources