初学SpringCloud之注册中心Eureka

  • 依赖
<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-starter-eureka-server</artifactId>
</dependency>
  • yml配置文件
server:
  port: 1001
eureka:
  instance:
    hostname: localhost
  client:
    register-with-eureka: false
    fetch-registry: false
    service-url:
      defaultZone: http://${eureka.instance.hostname}:${server.port}/eureka/
  • 启动配置
@EnableEurekaServer

创建完成.
访问地址为:localhost:自己配置的端口号
注意的坑有defaultZone不能写成default-zone

猜你喜欢

转载自blog.csdn.net/lightofsms/article/details/79844707