spring boot 2.x 和 eureka 的集成

我在集成spring boot 2.x和eureka时报错
  SpringCloud异常(Euruka):Application run failed java.lang.NoSuchMethodError:
  org.springframework.boot.builder.SpringApplicationBuilder
发现是兼容性的问题
参考:https://www.cnblogs.com/syp172654682/p/9015057.html看了下(重点在评论中)
 Spring Cloud Spring Boot
 Finchley 兼容Spring Boot 2.0.x,不兼容Spring Boot 1.5.x
 Dalston和Edgware 兼容Spring Boot 1.5.x,不兼容Spring Boot 2.0.x
 Camden 兼容Spring Boot 1.4.x,也兼容Spring Boot 1.5.x
 Brixton 兼容Spring Boot 1.3.x,也兼容Spring Boot 1.4.x
 Angel 兼容Spring Boot 1.2.x

然后修改我的pom为:
  以下为部分依赖

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.0.3.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>
    <spring.druid.version>1.1.10</spring.druid.version>
    <spring-cloud.version>Finchley.RELEASE</spring-cloud.version>
</properties>

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

<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>

再次运行就成功了。
展开阅读全文

没有更多推荐了,返回首页

©️2019 CSDN 皮肤主题: 大白 设计师: CSDN官方博客
应支付0元
点击重新获取
扫码支付

支付成功即可阅读