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/
相关推荐
NE_STOP9 小时前
MyBatis-配置文件解读及MyBatis为何不用编写Mapper接口的实现类
java
AI攻城狮12 小时前
RAG Chunking 为什么这么难?5 大挑战 + 最佳实践指南
人工智能·云原生·aigc
后端AI实验室14 小时前
用AI写代码,我差点把漏洞发上线:血泪总结的10个教训
java·ai
程序员清风16 小时前
小红书二面:Spring Boot的单例模式是如何实现的?
java·后端·面试
belhomme16 小时前
(面试题)Redis实现 IP 维度滑动窗口限流实践
java·面试
Be_Better16 小时前
学会与虚拟机对话---ASM
java
开源之眼18 小时前
《github star 加星 Taimili.com 艾米莉 》为什么Java里面,Service 层不直接返回 Result 对象?
java·后端·github
Maori31619 小时前
放弃 SDKMAN!在 Garuda Linux + Fish 环境下的优雅 Java 管理指南
java
用户9083246027319 小时前
Spring AI 1.1.2 + Neo4j:用知识图谱增强 RAG 检索(上篇:图谱构建)
java·spring boot
小王和八蛋20 小时前
DecimalFormat 与 BigDecimal
java·后端