在 Spring 引导中更新底层 Spring 版本



我正在运行此春季错误报告中描述的确切问题。

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

Juergen Hoeller已经修复了这个错误。他的评论:

当前的 5.0.2.BUILD-SNAPSHOT 同时包含此修订版。我将在周一之前将其向后移植到 4.3.13。

太棒了,但是如何在使用弹簧启动启动器的同时更新我的 spring 版本?以下是我的 gradle 文件,不包含指向春季版本的链接。这是否由我的 Spring 启动版本处理?Spring 入门项目是设置和安装特定的 Spring 版本还是只使用最新版本?

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")
}

提前感谢任何帮助。

此处定义了特定于项目的属性。您可以在 gradle/pom 中覆盖该属性,以便能够覆盖正在使用的版本。

我想它在gradle中也应该相似。

更新:

我的项目 pom.xml 将具有所有依赖项以及以下内容:

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

这将允许我的应用程序使用 Thymeleaf 3,而 Spring Boot 1.5.* 仍然附带:

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

因此,您应该能够在 Gradle 中执行类似操作 - 一个定义属性的地方。

最新更新