简体   繁体   中英

Updating the underlying spring version in spring boot

I am running in the exact issue described in this spring bug report.

https://jira.spring.io/browse/SPR-16149

Juergen Hoeller has fixed the bug. His comment:

The current 5.0.2.BUILD-SNAPSHOT contains this revision in the meantime. I'll backport it to 4.3.13 by Monday.

Fantastic, but how to I update my version of spring while using spring-boot-starter? The following is my gradle file containing no link to a spring version. Is this handled by my spring boot version? Do spring starter projects setup and install a specific spring version or do they just use latest?

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

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

group = 'company.'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = 1.8

repositories {
    mavenCentral()

    maven {
        url 'https://repo.spring.io/libs-milestone'
    }

}


dependencyManagement {
    imports {
        mavenBom 'org.springframework.cloud:spring-cloud-stream-dependencies:Elmhurst.M2'
    }
}

dependencies {
    compile("org.springframework.boot:spring-boot-starter")
    compile("org.springframework.boot:spring-boot-starter-web")
    compile("org.springframework.boot:spring-boot-starter-data-jpa")
    compile("org.springframework.cloud:spring-cloud-starter-stream-rabbit")


    compile(group: 'org.modelmapper', name: 'modelmapper', version: '0.7.5')
    compile("io.springfox:springfox-swagger2:2.7.0")
    compile('io.springfox:springfox-swagger-ui:2.7.0')



    testCompile("org.springframework.boot:spring-boot-starter-test")
    testCompile "org.mockito:mockito-core:2.+"

    runtime group: 'com.h2database', name: 'h2', version: '1.0.60'
    // runtime("mysql:mysql-connector-java")
}

Thanks in advance for any help.

There are project specific properties as defined here . You can override the property in your gradle/pom to be able to override version being used.

I guess it should be similar in gradle as well.

Update:

My project pom.xml would be have all the dependencies along with the following:

<properties>
  <thymeleaf.version>3.0.8.RELEASE</thymeleaf.version>
  <thymeleaf-layout-dialect.version>2.2.2</thymeleaf-layout-dialect.version>
</properties>

And this will allow my application to use Thymeleaf 3 while Spring Boot 1.5.* still ships with:

<thymeleaf.version>2.1.5.RELEASE</thymeleaf.version>
<thymeleaf-layout-dialect.version>1.4.0</thymeleaf-layout-dialect.version>

So you should be able to do something similar in Gradle - a place where you define properties.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM