DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Please enter at least three characters to search
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Because the DevOps movement has redefined engineering responsibilities, SREs now have to become stewards of observability strategy.

Apache Cassandra combines the benefits of major NoSQL databases to support data management needs not covered by traditional RDBMS vendors.

The software you build is only as secure as the code that powers it. Learn how malicious code creeps into your software supply chain.

Generative AI has transformed nearly every industry. How can you leverage GenAI to improve your productivity and efficiency?

Related

  • Actuator Enhancements: Spring Framework 6.2 and Spring Boot 3.4
  • How Spring Boot Starters Integrate With Your Project
  • A Practical Guide to Creating a Spring Modulith Project
  • Structured Logging in Spring Boot 3.4 for Improved Logs

Trending

  • Bridging UI, DevOps, and AI: A Full-Stack Engineer’s Approach to Resilient Systems
  • Developers Beware: Slopsquatting and Vibe Coding Can Increase Risk of AI-Powered Attacks
  • Proactive Security in Distributed Systems: A Developer’s Approach
  • How To Build Resilient Microservices Using Circuit Breakers and Retries: A Developer’s Guide To Surviving
  1. DZone
  2. Coding
  3. Frameworks
  4. Spring Boot Migration From 1.5 to 2.0.5

Spring Boot Migration From 1.5 to 2.0.5

Thinking about upgrading your Spring Boot application?

By 
Krishnan G user avatar
Krishnan G
·
Jan. 14, 19 · Tutorial
Likes (11)
Comment
Save
Tweet
Share
60.2K Views

Join the DZone community and get the full member experience.

Join For Free

Thinking of upgrading your Spring Boot application? In this post, I’d like to walk you through the process of upgrading a Spring Boot 1.x app to Spring Boot 2.

Dependencies

Java

Spring Boot 2.x will no longer support Java 7 and below, with Java 8 as the minimum requirement.

It’s also the first version to support Java 9. There are no plans to support Java 9 on the 1.x branch. If you want to use the latest Java release and take full advantage of the framework, Spring Boot 2.x is your only option.

Gradle

The Gradle minimum supported version is 3.4.

The Gradle has many value-added features to have our dependency on the central repository.

To create fat jars, bootRepackage Gradle’s task gets replaced with bootJar and bootWar to build jars and wars respectively.

It is interesting to know that Spring Boot 2.x will no longer apply the dependency management plugin by default.

If you want Spring Boot dependency management, then you should add:

apply plugin: 'io.spring.dependency-management'


A few highlights regarding minimum required versions:

  • Tomcat minimum supported version is 8.5
  • Hibernate minimum supported version is 5.2

Steps to Upgrade

Step 1:

Assuming that you are using a Gradle build tool for building your application, your build.gradle file should look as follows:

buildscript {
repositories { 
   jcenter()
   mavenCentral()
}

dependencies {
  classpath("org.springframework.boot:spring-boot-gradle-plugin:2.0.5.RELEASE")
 }
}

plugins {
   id 'org.springframework.boot' version '2.0.5.RELEASE'
}

apply plugin: 'java'
apply plugin: 'maven'
apply plugin: 'org.springframework.boot'

dependencies 
{
  compile group: 'javax.servlet', name: 'javax.servlet-api', version: '3.1.0'
  compile group: 'org.springframework.boot', name: 'spring-boot-starter-web'

}


Now, this will download all the required dependency jar files for the Spring Boot verison 2.0.5 release

Step 2:

Change the application properties as follows if you used any of the following properties in your application:

Servlet-Specific Server Properties

A number of server.* properties that are servlet-specific have moved to server.servlet:

Old property New property
server.context-parameters.* server.servlet.context-parameters.*
server.context-path server.servlet.context-path
server.jsp.class-name server.servlet.jsp.class-name
server.jsp.init-parameters.* server.servlet.jsp.init-parameters.*
server.jsp.registered server.servlet.jsp.registered
server.servlet-path server.servlet.path

Here is the list of commonly used application properties

Step 3:

Replace the deprecated methods and classes. Here are some of the deprecated classes that I came across and the respective classes

Deprecated Class New Class
org.springframework.web.context.request.RequestAttributes org.springframework.web.context.request.WebRequest
org.springframework.data.querydsl.QueryDslPredicateExecutor org.springframework.data.querydsl.QuerydslPredicateExecutor
org.springframework.boot.autoconfigure.web.DefaultErrorAttributes org.springframework.boot.web.servlet.error.DefaultErrorAttributes
org.springframework.web.context.request.ServletRequestAttributes org.springframework.web.context.request.ServletWebRequest
org.springframework.boot.web.support.SpringBootServletInitializer org.springframework.boot.web.servlet.support.SpringBootServletInitializer
WebConfigurer WebMvcConfigurer


Step 4:

Now, run your main class. Your application should be up and running.

Summary

In this article, we covered steps to migrating from Spring Boot 1.5.x to Spring Boot 2.0.5, where we discussed dependencies and how Java 8 becomes the minimum supported version.

Spring Framework Spring Boot

Opinions expressed by DZone contributors are their own.

Related

  • Actuator Enhancements: Spring Framework 6.2 and Spring Boot 3.4
  • How Spring Boot Starters Integrate With Your Project
  • A Practical Guide to Creating a Spring Modulith Project
  • Structured Logging in Spring Boot 3.4 for Improved Logs

Partner Resources

×

Comments
Oops! Something Went Wrong

The likes didn't load as expected. Please refresh the page and try again.

ABOUT US

  • About DZone
  • Support and feedback
  • Community research
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends:

Likes
There are no likes...yet! 👀
Be the first to like this post!
It looks like you're not logged in.
Sign in to see who liked this post!