spring cloud eureka相关的配置信息

深藏阁楼爱情的钟 2022-11-15 01:20 194阅读 0赞

相关参考地址

https://blog.csdn.net/yuanshangshenghuo/article/details/106962926

eurake 启动入口加 @EnableEurekaServer 标签

  1. package com.server.eureka;
  2. import org.springframework.boot.SpringApplication;
  3. import org.springframework.boot.autoconfigure.SpringBootApplication;
  4. import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer;
  5. @SpringBootApplication
  6. @EnableEurekaServer
  7. public class EurekaApplication {
  8. public static void main(String[] args) {
  9. SpringApplication.run(EurekaApplication.class, args);
  10. }
  11. }

yml 相关文件配置信息

  1. server: # 服务端口
  2. port: 9090
  3. spring:
  4. application: # 应用名字,eureka 会根据它作为服务id
  5. name: spring-cloud-eureka-server
  6. eureka:
  7. instance:
  8. hostname: localhost
  9. client:
  10. service-url: # eureka server 的地址, 咱们单实例模式就写自己好了
  11. defaultZone: http://localhost:9090/eureka
  12. register-with-eureka: true # 不向eureka server 注册自己
  13. fetch-registry: true # 不向eureka server 获取服务列表

发表评论

表情:
评论列表 (有 0 条评论,194人围观)

还没有评论,来说两句吧...

相关阅读