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/
相关推荐
WiChP3 小时前
【V0.1B5】从零开始的2D游戏引擎开发之路
java·服务器·数据库
cch89183 小时前
汇编与Java:底层与高层的编程对决
java·开发语言·汇编
荒川之神4 小时前
拉链表概念与基本设计
java·开发语言·数据库
cch89184 小时前
汇编与Go:底层到高层的编程差异
java·汇编·golang
chushiyunen4 小时前
python中的@Property和@Setter
java·开发语言·python
禾小西4 小时前
Java中使用正则表达式核心解析
java·python·正则表达式
yoyo_zzm4 小时前
JAVA (Springboot) i18n国际化语言配置
java·spring boot·python
APIshop4 小时前
Java获取京东商品详情接口(item_get)实战指南
java·linux·数据库
Mr.Entropy4 小时前
springboot2.x集成Flyway
java