gpt4 book ai didi

spring-boot - 无法呈现 Eureka 仪表板

转载 作者:行者123 更新时间:2023-12-01 13:20:37 27 4
gpt4 key购买 nike

我正在使用 spring boot 创建 spring eureka 独立应用程序服务器。但是当我尝试加载 Eureka 服务器仪表板时,错误页面出现在附件中。

enter image description here

pom.xml 是

<?xml version="1.0" encoding="UTF-8"?>

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

<groupId>com.oyeplay</groupId>
<artifactId>service-registry</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>

<name>service-registry</name>
<description>Demo project for Spring Boot</description>

<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.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.8</java.version>
<spring-cloud.version>Finchley.RC1</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-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-config</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>

<repositories>
<repository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/milestone</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>

application.yml 是

    server:
port: 8761

eureka:
instance:
hostname: localhost
client:
registerWithEureka: false
fetchRegistry: false
serviceUrl:
defaultZone: http://${eureka.instance.hostname}:${server.port}/eureka/

ServiceRegistryApplication.java 是

    package com.oyeplay.serviceregistry;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer;


@SpringBootApplication
@EnableEurekaServer
public class ServiceRegistryApplication {

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

}
}

谁能告诉我我犯了什么错误?

最佳答案

如果检查 Spring 导向器https://spring.io/guides/gs/service-registration-and-discovery/观察到同样的事情,即 Eureka 仪表板没有显示。

这可能是由于 Spring Boot、Spring Cloud 和 Netflix Eureka Server 库的最新版本发生了变化。似乎文档缺少这一部分。

如果你想真正看到 Eureka 仪表板,现在只需按如下方式降级依赖项:

  • Spring boot 启动器父级:使用 <version>1.5.10.RELEASE</version>而不是 <version>2.0.1.RELEASE</version>

  • Spring Cloud 版本:使用 <spring-cloud.version>Edgware.SR3</spring-cloud.version>代替 <spring-cloud.version>Finchley.RC1</spring-cloud.version>

  • 依赖于 Eureka Server:使用 <artifactId>spring-cloud-starter-eureka-server</artifactId>反而的 <artifactId>spring-cloud-starter-netflix-eureka-server</artifactId>

关于spring-boot - 无法呈现 Eureka 仪表板,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50069134/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com