How to upgrade the Spring Framework version from 4.0.5.RELEASE to 5.3.20 - spring

I want to upgrade the Spring Framework version from 4.0.5.RELEASE to 5.3.20 using Maven.
The versions in my pom.xml is
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java-version>1.8</java-version>
<org.springframework-version>4.0.5.RELEASE</org.springframework-version>
<org.springframework-security-version>3.2.5.RELEASE</org.springframework-security-version>
<org.apache.tiles-version>3.0.4</org.apache.tiles-version>
<org.hibernate-version>4.2.15.Final</org.hibernate-version><!-- 4.3.5.Final -->
<org.aspectj-version>1.6.10</org.aspectj-version>
<org.slf4j-version>1.7.7</org.slf4j-version>
<jackson.version>1.9.10</jackson.version>
</properties>
Can anybody help me in which all files I have to make changes.
Do I need to change other versions also in pom.xml to make it compatible with the new Spring version?
PS - I am new to Spring Framework. Would really appreciate any help.

Related

The import com.xom.dm.mulesoft.AbstractInputTransformer cannot be resolved

I am new to the Mulesoft and Java. We have a Mule application in Mule 3.9.1, jdk8 and Maven 3.8.4. I am getting below errors could you please help to resolve the Anypoint Studio setup issues.
The import com.xom.dm.mulesoft.AbstractInputTransformer cannot be resolved
The method getFunctionalMap(String) of type PlannerGroupsInputTransformer must override a superclass method
Unable to find type 'org.mule.module.apikit.exception.NotFoundException'
<modelVersion>4.0.0</modelVersion>
<groupId>com.xom.dm.project</groupId>
<artifactId>dm-10-notifications</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>mule</packaging>
<name>Mule Application</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<mule.version>3.9.1</mule.version>
<mule.tools.version>1.2</mule.tools.version>
<munit.version>1.3.8</munit.version>
<mule.munit.support.version>3.9.1</mule.munit.support.version>
<service.instance>${instance}</service.instance>
</properties>
I have tried changing build path and jre libraries... nothing works.
Probably the project is not correctly configured to build with Anypoint Studio 6 built-in Maven support. That you are trying to configure manually the build path is a tip that something is wrong for a Maven based project. Studio should configure the build path automatically from the pom. You must not change it manually. Read the documentation pages for that feature that I shared above and all its child pages to learn how to use a Maven project correctly in Studio 6.

Why does spring dependencies on Maven Central differ from actual local?

I am using spring-boot-starter-parent 2.3.9.RELEASE which according to Maven Central should give me spring-boot-starter-security 2.3.9.RELEASE which in turn should give me spring-security-config 5.3.8.RELEASE.
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.3.9.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
However, when I look at Eclipse I see spring-security-config 5.3.5.RELEASE. I dont understand why my local is not reflecting spring-security-config 5.3.8.RELEASE for this artifact even though spring boot starter parent and spring boot starter security (both parents of this) are correctly showing 2.3.9.RELEASE. Also I'm not sure I understand what "Managed from 5.3.8.RELEASE" means in the screenshot. Could someone assist ?
This means that an entry in your <dependencyManagement> section of the POM overrode the version.
This may be a direct entry or a BOM, which you recognise by <scope>import</scope>.

creating Spring boot starter project

When i create my spring Boot starter project im getting error as maven configuration problem. Please help me to solve.
enter image description here
Similar Bug was reported in eclipse: https://bugs.eclipse.org/bugs/show_bug.cgi?id=547340
You can fix this by temporary downgrading the maven jar plugin version to 3.1.1 from 3.1.2. Add this to the properties section:
<maven-jar-plugin.version>3.1.1</maven-jar-plugin.version>
In your pom.xml
<properties>
<java.version>1.8</java.version>
<maven-jar-plugin.version>3.1.1</maven-jar-plugin.version>
</properties>
Update: A fix has been released. Click Help > Check for updates in Eclipse/STS and install the newest m2e connector.

Maven control version of transitive dependencies of Spring Boot

I have a simple spring boot app that I am trying to add spring cloud consul to. Spring cloud consul relies on a newer version of spring boot. In my POM I have specified version 1.3.5.RELEASE for all my spring boot artifacts.
The problem is that, even though version 1.3.5 is specified for spring-boot-starter-web it still downloads dependencies with version 1.2.3
Is there a way to have maven get the 1.3.5.RELEASE for ALL spring boot artifacts, including transitive dependencies? I know I can explicitly list them all, but is there a better way?
Here is the POM depenency view from eclipse:
Yes, simple use correct parent:
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.3.6.RELEASE</version>
<relativePath/>
</parent>
and remove versions from spring boot dependencies.

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?
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.

Resources