Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to override the managed version of dependencies in Spring Boot

Tags:

spring-boot

Spring Boot allows us to change the Java version using:

<properties>
    <java.version>1.8</java.version>
</properties>

Is there any property to change the Java EE version or spring version in my Spring Boot pom.xml?

Currently I override the managed version using:

<dependency>
    <groupId>javax.servlet</groupId>
    <artifactId>javax.servlet-api</artifactId>
    <version>3.0.1</version>
</dependency>

Is there a better way to do this, like just setting properties?

Spring Boot 1.2.3 gives you Spring 4.1.6 by default. How can I force Spring Boot to give me 4.1.5 instead, just by setting properties?

like image 902
Rajesh Parab Avatar asked Sep 06 '25 03:09

Rajesh Parab


1 Answers

This in your pom.xml should do it:

<properties>
    <spring.version>4.1.5.RELEASE</spring.version>
</properties>

All straight from the docs.

Before you go overboard overriding versions of dependencies, heed this advise (from the link above):

Each Spring Boot release is designed and tested against a specific set of third-party dependencies. Overriding versions may cause compatibility issues.

like image 164
ci_ Avatar answered Sep 07 '25 23:09

ci_