在spring boot

时间:2017-11-06 10:28:39

标签: java spring spring-boot gradle

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

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

Juergen Hoeller修复了这个漏洞。他的评论:

  

当前5.0.2.BUILD-SNAPSHOT包含此修订版。我将在星期一之前将其向后移至4.3.13。

太棒了,但是如何在使用spring-boot-starter时更新我的​​弹簧版本?以下是我的gradle文件,其中没有指向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")
}

提前感谢您的帮助。

1 个答案:

答案 0 :(得分:0)

定义了项目特定属性here。您可以覆盖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中执行类似的操作 - 您可以在其中定义属性。