java.lang.NoSuchMethodError: org.springframework.boot.builder.SpringApplicationBuilder [英] java.lang.NoSuchMethodError: org.springframework.boot.builder.SpringApplicationBuilder

查看:55
本文介绍了java.lang.NoSuchMethodError: org.springframework.boot.builder.SpringApplicationBuilder的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在学习 springboot 和微服务.我创建了 3 个服务,并且一切正常.现在我已经创建了发现服务器,使用 start.spring.io 通过添加Eureka Server"作为依赖项.

I am learning springboot and microservices. I have created 3 services and all are working fine. Now i have created discovery server, using start.spring.io by adding "Eureka Server" as dependency.

我的pom.xml如下:

My pom.xml is as follows:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>1.5.9.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <groupId>io.springboot.microserices</groupId>
    <artifactId>discovery-server</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>discovery-server</name>
    <description>Demo project for Spring Boot</description>
<properties>
    <java.version>1.8</java.version>
    <spring-cloud.version>Finchley.SR1</spring-cloud.version>
</properties>

<dependencies>
    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-starter-netflix-eureka-server</artifactId>
    </dependency>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
    </dependency>
</dependencies>

<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-dependencies</artifactId>
            <version>${spring-cloud.version}</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
    </dependencies>
</dependencyManagement>

<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>
    </plugins>
</build>

我的主要课程如下:

    package io.springboot.microserices.discoveryserver;
    import org.springframework.boot.SpringApplication;
    import org.springframework.boot.autoconfigure.SpringBootApplication;
    import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer;
    @SpringBootApplication
    @EnableEurekaServer

public class DiscoveryServerApplication {

    public static void main(String[] args) {
        SpringApplication.run(DiscoveryServerApplication.class, args);
    }

}

但是我无法运行该应用程序.如果我运行,我将低于异常.有人能帮我解决这个问题吗.

But i am unable to run the application. If i run, i am getting below exception. Could some one help me in resolving this issue.

16:07:02.761 [main] ERROR org.springframework.boot.SpringApplication - Application startup failed
java.lang.NoSuchMethodError: org.springframework.boot.builder.SpringApplicationBuilder.<init>([Ljava/lang/Class;)V
    at org.springframework.cloud.bootstrap.BootstrapApplicationListener.bootstrapServiceContext(BootstrapApplicationListener.java:170)
    at org.springframework.cloud.bootstrap.BootstrapApplicationListener.onApplicationEvent(BootstrapApplicationListener.java:104)

推荐答案

Finchley 与 Spring Boot 1.x 不兼容,您必须使用 Boot 2.0.x.对于 Boot 2.1.x,您需要使用 Greenwich.

Finchley is not compatible with Spring Boot 1.x, You must use Boot 2.0.x. For Boot 2.1.x you need to use Greenwich.

这篇关于java.lang.NoSuchMethodError: org.springframework.boot.builder.SpringApplicationBuilder的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆