【问题标题】:Spring Boot Upgrade to LatestSpring Boot 升级到最新版本
【发布时间】:2019-05-19 04:42:21
【问题描述】:

在升级 springBoot starter parent 2.1.1.Release 时出现以下异常。

java.lang.NoSuchMethodError: org.springframework.boot.builder.SpringApplicationBuilder.<init>([Ljava/lang/Object;)V
    at org.springframework.cloud.bootstrap.BootstrapApplicationListener.bootstrapServiceContext(BootstrapApplicationListener.java:120)
    at org.springframework.cloud.bootstrap.BootstrapApplicationListener.onApplicationEvent(BootstrapApplicationListener.java:84)
    at org.springframework.cloud.bootstrap.BootstrapApplicationListener.onApplicationEvent(BootstrapApplicationListener.java:62)
    at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172)
    at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165)
    at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139)
    at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:127)
    at org.springframework.boot.context.event.EventPublishingRunListener.environmentPrepared(EventPublishingRunListener.java:75)
    at org.springframework.boot.SpringApplicationRunListeners.environmentPrepared(SpringApplicationRunListeners.java:54)
    at org.springframework.boot.SpringApplication.prepareEnvironment(SpringApplication.java:347)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:306)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1260)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1248)
    at com.nbcuni.compass.title.TServiceApplication.main(TitleServiceApplication.java:34)

POM.xml

PFB, pom.xml 具有完整的父 2.1.1.Release 和依赖管理作为 Brixton.SR5 版本详细信息

<parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.1.1.Release</version>
        <relativePath /> <!-- lookup parent from repository -->
    </parent>
<properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <java.version>1.9</java.version>
        <springfox.version>2.6.0</springfox.version>
    </properties>
<dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-dependencies</artifactId>
                <version>Brixton.SR5</version>
                <!-- <version>Brixton.SR5</version> -->
                <type>pom</type>
                <scope>import</scope>
            </dependency>
                    </dependencies>
    </dependencyManagement>

【问题讨论】:

  • 如果您使用的是 springboot 2.1,那么您真的应该在格林威治发布列车上

标签: java spring spring-boot spring-cloud


【解决方案1】:

Brixton.SR5 是 from 2016 并且不支持 Spring Boot 2,因为它已发布 in 2018。如果它适用于低于 2.1.1 的 Spring Boot 版本,那是偶然的。

您需要将 Spring Cloud 升级到最新版本,例如Finchley SR2.

【讨论】:

  • 但需要spring-cloud-starter-eureka,其他spring cloud中没有,仅在Brixton.SR5中可用
  • 这个依赖在 Spring Cloud 的最新版本中被重命名为spring-cloud-starter-netflix-eureka-client(除非你指的是spring-cloud-starter-netflix-eureka-server的服务器)。
  • cool 让我检查一下,即使我们拥有最新的格林威治 M3,您是否有任何理由拥有 Finchley SR2
  • Green 没有正式发布和支持。 M3 表示里程碑 3。
  • Could not transfer artifact com.netflix.netflix-commons:netflix-infix:jar:0.3.0 from/to central (repo1.maven.org/maven2): Error transfer file: repo1.maven.org: Unknown托管 repo1.maven.org
【解决方案2】:

Brixton 基于 Spring Boot 1.3.x 构建

Finchley 使用 Spring Boot 2.0.x 构建和工作,预计不会 使用 Spring Boot 1.5.x。

用芬奇利代替布里克斯顿。在您的 pom 中添加以下依赖项:

<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-dependencies</artifactId>
    <version>Finchley.RELEASE</version>
    <type>pom</type>
</dependency>

Follow this link for details.

【讨论】:

    猜你喜欢
    • 2016-05-24
    • 2021-01-20
    • 1970-01-01
    • 2012-04-21
    • 2022-01-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多