Upgrading Spring Boot To The 2.3.4 Release

Posted By : Shivansh Pandey | 24-Dec-2020

Spring boot upgrade from 1.5 to 2.3.4 Release

Upgradation of the spring boot application can be done in a few steps without using any external tool. 

 

Upgrading your spring boot old version applications to the latest stable versions has always been difficult, sometimes it encounters various kinds of exceptions that take too much time to get resolved. 

We will learn to upgrade our old version application to spring boot 2.3 in this blog. 

There are many external upgrade tools available, but upgrading through traditional methods is the perfect way to upgrade your application somehow. 

Updating your pom is the first thing you need to do.

You also need to upgrade your compatible spring cloud version to the desired spring boot version in your pom.xml file, ie Hoxton.SR8, Greenwich, etc.

  Step 1- Open the pom.xml and replace the <parent> with the the following code.

       <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.3.4.RELEASE</version>
        <relativePath /> <!-- lookup parent from repository -->
    </parent> 

Step 2- Change the spring cloud version to Hoxton.SR8.

    <properties>
        <java.version>1.8</java.version>
        <spring-cloud.version>Hoxton.SR8</spring-cloud.version>
    </properties>

you can check the spring cloud versions compatible to your springboot version from official website. 

you can also create a new pom file from https://start.spring.io/ for the latest version and paste it to your pom.xml.

 

Also Read: Spring Boot Application Configured As Eureka Server

 

Now your ide will download the upgraded jars for each dependency.

In case you are running the application from the terminal, it will start downloading the dependencies once you run mvn spring-boot:run command.

 

Step 3 - Your spring boot dependencies got upgraded and you will find some errors for repository methods beacuse findOne(),deleteOne() got replaced with Optona<T>findById()and deleteById() .

  Replace those methods with their upgraded syntaxes.

Step 4- mvn clean the application, and then mvn install the application. (In case you get some exception, track that file, that must be because of old syntax, resolve that statement and mvn install it again)

 

Now your application got upgraded, you can simply run your application.

The most common exception that gets encountered after upgradation is 'Error creating bean with name filename.java' , track that file, and resolve that statement with upgraded syntax.  

 

For more information, you can also visit to spring boot official migration documents. After every new release spring releases a new migration document that might be helpful to resolve some critical errors.

 

Also Read: Command line arguments in spring boot

 

We, at Oodles Technologies, provide full-scale SaaS app development services to build scalable, responsive, and quality-driven web and mobile applications. Contact us for technical assistance or drop us a line at [email protected] for more detail.

About Author

Author Image
Shivansh Pandey

He is a backend developer having good knowledge of java. He is having experience in Springboot, MQTT, Spring Cloud, etc. He writes optimized codes and having good problem-solving techniques.

Request for Proposal

Name is required

Comment is required

Sending message..