Spring Boot和Spring Cloud上的服务发现错误

时间:2018-11-04 23:46:40

标签: spring maven spring-boot spring-cloud

我正在学习Spring Boot和Spring Cloud。我为Eureka服务器设计了一个非常简单的应用程序。我的POM如下-


http://maven.apache.org/xsd/maven-4.0.0.xsd“>     4.0.0

<groupId>com</groupId>
<artifactId>service-discovery-ha</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>

<name>service-discovery-high-availability</name>
<description>Demo project for Spring Cloud Serivice Discovery</description>

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.1.0.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.8</java.version>
</properties>

<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-dependencies</artifactId>
            <version>Camden.SR1</version>
            <type>POM</type>
            <scope>import</scope>
        </dependency>
    </dependencies>
</dependencyManagement>


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

    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-starter-eureka-server</artifactId>
        <version>1.4.6.RELEASE</version> 
    </dependency>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>

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

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

但是我遇到了以下错误-

  

17:12:48.491 [main]错误org.springframework.boot.SpringApplication-应用程序运行失败   java.lang.NoSuchMethodError:org.springframework.boot.builder.SpringApplicationBuilder。([Ljava / lang / Object;)V       在org.springframework.cloud.bootstrap.BootstrapApplicationListener.bootstrapServiceContext(BootstrapApplicationListener.java:161)       在org.springframework.cloud.bootstrap.BootstrapApplicationListener.onApplicationEvent(BootstrapApplicationListener.java:102)       在org.springframework.cloud.bootstrap.BootstrapApplicationListener.onApplicationEvent(BootstrapApplicationListener.java:68)       在org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172)       在org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165)       在org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139)       在org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:127)       在org.springframework.boot.context.event.EventPublishingRunListener.environmentPrepared(EventPublishingRunListener.java:75)       在org.springframework.boot.SpringApplicationRunListeners.environmentPrepared(SpringApplicationRunListeners.java:54)       在org.springframework.boot.SpringApplication.prepareEnvironment(SpringApplication.java:347)       在org.springframework.boot.SpringApplication.run(SpringApplication.java:306)       在org.springframework.boot.SpringApplication.run(SpringApplication.java:1260)       在org.springframework.boot.SpringApplication.run(SpringApplication.java:1248)       

我收到Maven安装和Spring Boot运行时错误。我的猜测是依赖错误。除此以外还有什么其他的吗?我不知道。 这个错误是什么意思? 请帮助我解决问题。

0 个答案:

没有答案