【问题标题】:Spring Boot [2.7.5] is not compatible with this Spring Cloud release train: Eureka-clientSpring Boot [2.7.5] 与此 Spring Cloud 发布系列不兼容:Eureka-client
【发布时间】:2023-02-08 21:19:17
【问题描述】:

启动 Eureka-client 应用程序并收到错误: Spring Boot [2.7.5] 与此 Spring Cloud 发布系列不兼容。

spring-boot-starter-parent 2.7.5

Eureka客户端应用包com.example.demo;
导入 org.springframework.boot.SpringApplication; 导入 org.springframework.boot.autoconfigure.SpringBootApplication; 导入 org.springframework.cloud.netflix.eureka.EnableEurekaClient;

@SpringBootApplication
@EnableEurekaClient
public class EurekaClientApplication {
    public static void main(String[] args) {
        SpringApplication.run(EurekaClientApplication.class, args);        
    }
}

应用程序.properties

eureka:
  client:
    serviceUrl:
          defaultZone: ${EUREKA_URI:http://localhost:8761/eureka}
instance:
    preferIpAddress: true
    lease-renewal-interval-in-seconds: 30

pom.xml

<?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 https://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>2.7.5</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <groupId>com.example</groupId>
    <artifactId>eureka-client</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>eureka-client</name>
    <description>Demo project for Spring Boot</description>
    <properties>
        <java.version>11</java.version>
        <spring-cloud.version>2020.0.2</spring-cloud.version>
    </properties>
    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-bootstrap</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
        </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> 
</project>

可能是什么原因?

【问题讨论】:

    标签: spring-boot netflix-eureka


    【解决方案1】:

    您使用的 Spring Cloud 版本可能与 Spring Boot 版本不兼容。它在标签中定义:

    &lt;spring-cloud.version&gt;2020.0.2&lt;/spring-cloud.version&gt;

    我认为 2021.0.5 spring-cloud 版本应该可以。

    【讨论】:

    • 我更改为 2021.0.5,但没有帮助:描述:由于以下原因,您的项目设置与我们的要求不兼容:- Spring Boot [2.7.5] 与此 Spring Cloud 发布火车不兼容操作:考虑应用以下操作: - 将 Spring Boot 版本更改为以下版本之一 [2.4.x, 2.5.x]。
    【解决方案2】:

    我不确定您是否可以将来自 Netflix 堆栈的解决方案与 Spring Cloud 2021.x 一起使用。肯定不再支持 Hystrix 和 Ribbon。

    【讨论】:

      猜你喜欢
      • 2020-11-04
      • 2022-01-01
      • 2020-09-03
      • 2018-06-06
      • 2022-11-14
      • 2021-08-25
      • 2019-05-01
      • 2021-12-16
      • 1970-01-01
      相关资源
      最近更新 更多