Springboot3.0.x 集成并构建Eureka的注册中心

创建一个eureka-server的模块

在pom中引入eureka

java 复制代码
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-netflix-eureka-server</artifactId>
            <version>3.1.2</version>
        </dependency>

在application.yml文件中配置Eureka

java 复制代码
server:
  port: 8079

eureka:
  instance:
    hostname: bowen-eureka
  client:
    register-with-eureka: false
    fetch-registry: false
    service-url:
      defalutZone: http://${eureka.instance.hostname}:${server.port}/eureka/

创建 EurekaServerApplication 启动类

java 复制代码
package com.lingyang;

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

/**
 * @author **文
 * @Description:
 * @createDate 2024/8/12 14:25
 **/
@SpringBootApplication
@EnableEurekaServer
public class EurekaServerApplication {

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

}

最后我被坑了,eureka不维护了。我用jdk17搞。操蛋了。解决不了

相关推荐
丙氨酸長鏈11 分钟前
[Bukkit插件开发]手持发射器箭矢机枪 教学文档 面向Python/C#开发者入门Java与Bukkit API
java·python·c#
Nontee13 分钟前
设计模式:模板方法与策略,从“每个字都认识“到能说清它们在干嘛
java·数据库·设计模式
我是唐青枫15 分钟前
Java ReentrantLock 实战详解:比 synchronized 更灵活的可重入锁
java·开发语言
晨曦中的暮雨1 小时前
Virtual Thread 优化 Spring AI 阻塞式 LLM I/O:对照压测报告
java·并发·个人项目
AKA__Zas2 小时前
芝士算法(前缀和2.0)
java·数据结构·算法·leetcode·哈希算法·学习方法
caishenzhibiao2 小时前
降雨带波段点差 同花顺期货通指标
java·c语言·c#
七夜zippoe2 小时前
OpenClaw Prompt 工程:从角色设定到 Skill 封装的 Agent 输出质量方法论
java·服务器·prompt·openclaw·skill封装
rosmis2 小时前
agent各指标定义
android·java·开发语言
mifengxing2 小时前
Java 集合进阶(一)
java·开发语言·数据结构·复习笔记
令狐前生3 小时前
Intellij IDEA 2025 破解安装
java·ide·intellij-idea