java - 在Spring Boot中更新基础Spring版本

标签 java spring spring-boot gradle

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

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

Juergen Hoeller已修复该错误。他的评论:

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



太棒了,但是在使用spring-boot-starter时如何更新spring版本?以下是我的gradle文件,其中没有指向 Spring 版本的链接。这是由我的Spring Boot版本处理的吗? spring starter项目是否设置并安装了特定的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")
}

在此先感谢您的帮助。

最佳答案

有一些项目特定的属性,如here所定义。您可以覆盖gradle / pom中的属性,以覆盖正在使用的版本。

我猜它应该也是如此。

更新:

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

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

这将允许我的应用程序在Spring Boot 1.5。*仍随附的情况下使用Thymeleaf 3:
<thymeleaf.version>2.1.5.RELEASE</thymeleaf.version>
<thymeleaf-layout-dialect.version>1.4.0</thymeleaf-layout-dialect.version>

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

关于java - 在Spring Boot中更新基础Spring版本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47134747/

相关文章:

java - 在REDIS缓存中保存/检索列表或记录

Java/Spring - 列表的 JPA 持久化

spring-boot - 在 Spring Boot Rest API 中将 Map 用作 @RequestBody 不起作用

java - 如何在基于 JAVA 的 spring config 中配置 Hibernate Db 连接设置

java - 创建 50 个线程连接到服务器以进行负载测试

java - 阅读包含原始内容的pdf文件

java - 在Java8中使用空分析注释

java - 如何在 Wildfly 中将外部属性文件加载到 Spring Boot

java - 两个 spring boot 应用程序相互之间通过消息队列进行通信

java - org.apache.xml.security 在 Spring Boot 下不起作用