Rajesh Parab
Rajesh Parab

Reputation: 51

How to override the managed version of dependencies in 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?

Upvotes: 4

Views: 13290

Answers (1)

ci_
ci_

Reputation: 8774

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.

Upvotes: 6

Related Questions