Spring boot document suggest mostly you don't need to override the BOM dependency in practice.
As there are provisions to override the dependency. Scenario :: Declared in parent pom :
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>2.1.4</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
Declared in child pom
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-mongodb</artifactId>
</dependency>
Is it right/best practice to override spring-boot-starter-data-mongodb with higher version lets say 2.2.1 for spring boot 2.1.4
My take is override with downgraded version seems okay in theory , but to upgrade to higher version may invite issues.
Also despite overriding the declaration in parent pom, dependency of overridden dependency still as per the BOM decalaration.
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-mongodb</artifactId>
<version>2.2.1.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>2.1.4</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
I think there is a risk in doing this but sometimes it has to be done. You or the team would have to weigh the pros/cons. Here are some situations that may lead to advancing a dependency's version ahead of the BOM.
Things to take into account before doing this:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With