首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >将Spring Boot应用程序升级到最新版本

将Spring Boot应用程序升级到最新版本
EN

Stack Overflow用户
提问于 2017-11-24 19:43:52
回答 1查看 16.3K关注 0票数 6

我有一个Spring Boot项目,它基于

Spring Framework 4.3.7.RELEASESpring Boot 1.5.2.RELEASE

我使用Java配置方法。如何将此项目升级到Spring Boot和Spring Framework (Spring Boot 2.xSpring Framework 5.x)的最新版本?我已经查看了this page,但不幸的是它对我没有什么真正的帮助。将很高兴在这方面得到任何进一步的指导。

这是我的build.gradle文件的样子:

代码语言:javascript
运行
复制
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')
}
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2017-11-24 20:57:26

升级的第一步是增加spring-boot-starter-parent的版本。在您使用Gradle的情况下,它将是属性springBootVersion中的版本。

然而,对于Spring Boot 2,需要注意的是,目前还没有最终版本,因此您必须包含Spring Boot中的里程碑或快照存储库。您可以在这里找到URL:https://docs.spring.io/spring-boot/docs/2.0.0.M4/reference/htmlsingle/#getting-started-first-application-pom,尽管该文档是针对Maven的。

Gradle的正确设置如下所示:

代码语言:javascript
运行
复制
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" }
}
票数 10
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/47472610

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档