You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Spring Boot集成Eureka Server遇白标错误及UI无法显示求助

解决Eureka Server白标错误&UI无法显示问题

1. 修复版本兼容性问题

Spring Cloud 2023.0.0(代号Leyton)仅支持Spring Boot 3.0及以上版本,你当前使用的Spring Boot 2.6.3和它完全不兼容,这是核心问题。

替换pom.xml中的spring-cloud.version为适配Spring Boot 2.6.3的版本:

<properties>
    <java.version>17</java.version>
    <spring-cloud.version>2021.0.8</spring-cloud.version> <!-- Jubilee版本,完美适配Spring Boot2.6.x -->
</properties>

2. 移除冲突依赖

你的pom中引入了javax.servlet:servlet-api:2.5,但Spring Boot2.6.3使用的是Jakarta Servlet API,旧依赖会导致容器冲突,直接删除该依赖块:

<!-- 删掉这段冲突依赖 -->
<dependency>
    <groupId>javax.servlet</groupId>
    <artifactId>servlet-api</artifactId>
    <version>2.5</version>
    <scope>provided</scope>
</dependency>

3. 简化配置文件

Eureka Server默认已经配置好Freemarker模板路径,不需要额外添加spring.freemarker相关配置,直接删除以下内容:

spring:
  freemarker:
    prefer-file-system-access: false
    template-loader-path: classpath:/templates/

另外,你配置了eureka.dashboard.path: /dashboard,所以访问UI的正确路径是http://localhost:8761/dashboard;如果想使用默认根路径访问,直接删掉eureka.dashboard.path配置即可。

4. 验证启动类注解

确保启动类上的@EnableEurekaServer注解正确引入:

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

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

最终操作步骤

  1. 执行mvn clean install清理并重新构建项目
  2. 重启Eureka Server服务
  3. 访问对应路径(默认根路径或配置的/dashboard)

内容的提问来源于stack exchange,提问作者prasanna kumar

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.29 20:33:21