Upgrading Spring Boot Application to Latest Version

Viewed 21936

I have a Spring Boot project which is based on
Spring Framework 4.3.7.RELEASE and Spring Boot 1.5.2.RELEASE.
I use the Java configuration approach. How Do I upgrade this project to the latest version of Spring Boot and Spring Framework (Spring Boot 2.x, Spring Framework 5.x)? I have checked out this page, but unfortunately it was of no real help to me. Would be glad to receive any further guidance on this.

This is how my build.gradle file looks like:

buildscript {
    ext {
        springBootVersion = '1.5.2.RELEASE'
    }
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
    }
}

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

version = '0.1.0-alpha.2'
sourceCompatibility = 1.8

repositories {
    mavenCentral()
}

bootRun.systemProperties = System.properties

springBoot {
    executable = true
}

dependencies {
    compile('org.springframework.boot:spring-boot-starter-web')
    compile('org.springframework.boot:spring-boot-starter-data-jpa')
    compile('org.springframework.boot:spring-boot-starter-security')
    compile('mysql:mysql-connector-java')
    compile('org.modelmapper:modelmapper:1.1.0')
    compile('com.fasterxml.jackson.datatype:jackson-datatype-jsr310')
    testCompile('org.springframework.boot:spring-boot-starter-test')
    testCompile('org.springframework.security:spring-security-test')
    testCompile('org.modelmapper:modelmapper:1.1.0')
}
1 Answers

The first step to do an upgrade, is to just increase the version of the spring-boot-starter-parent. In your case with Gradle, it would the version in the property springBootVersion.

For Spring Boot 2 however it is important to note, that there is no final release yet, so you have to include the milestone or snapshot repositories from Spring Boot. You can find the URLs here: https://docs.spring.io/spring-boot/docs/2.0.0.M4/reference/htmlsingle/#getting-started-first-application-pom though that documentation is for Maven.

The proper settings for Gradle would look like this:

buildscript {
    ext {
        springBootVersion = '2.0.0.M6'
    }
    repositories {
        mavenCentral()
        maven { url "https://repo.spring.io/snapshot" }
        maven { url "https://repo.spring.io/milestone" }
    }
    dependencies {
        classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
    }
}

repositories {
    mavenCentral()
    maven { url "https://repo.spring.io/snapshot" }
    maven { url "https://repo.spring.io/milestone" }
}
Related