p9 Eureka-搭建eureka服务

1.在user-service项目引入spring-cloud-starter-netflix-eureka-client的依赖

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

2.加入注解

复制代码
@EnableEurekaServer
@SpringBootApplication
public class EurekaApplication {
    public static void main(String[] args) {
        SpringApplication.run(EurekaApplication.class,args);
    }
}

3.在application.yml文件,编写下面的配置:

复制代码
server:
  port: 10086
spring:
  application:
    name: eurekaserver
eureka:
  client:
    service-url:
      defaultZone: http://127.0.0.1:10086/eureka/
相关推荐
evans在进步10 小时前
LeetCode 394:字符串解码——Java 单栈模拟与嵌套解析详解
java·python·leetcode
重庆小透明10 小时前
深入探寻微服务【第四篇微服务监控实战】
微服务·云原生·架构
m0_5474866611 小时前
《Java程序设计与实践 》全套PPT课件2026
java·开发语言
土司大王11 小时前
LeetCode hto100——字母异位词分组
java·算法·leetcode
码匠许师傅11 小时前
【C++ 面试真题】聊聊 C++ 中的 lambda 表达式
java·c++·面试
QCodingDev12 小时前
Spring AI Alibaba ReAct Agent实战:从Tool Calling到Agent,企业AI复杂业务该如何设计?
java·人工智能·agent·ai编程·spring ai
RainCity12 小时前
Java Swing 自定义组件库分享(十六)
java·笔记·后端
流烟默12 小时前
Kubernetes 探针完全指南:健康检查机制深度解析
云原生·容器·kubernetes
赵广陆13 小时前
企业实战:Markdown图片检索
android·java·开发语言
C++、Java和Python的菜鸟13 小时前
第3章 从0开始用若依
java·开发语言