主机名称:服务名称修改

当前问题

我希望显示的localhost:cloud-payment-server:8091是自己定义的主机名称

1610803428656.png

修改pom

  1. eureka:
  2. client:
  3. register-with-eureka: true
  4. fetch-registry: true
  5. service-url:
  6. defaultZone: http://eureka7002.com:7002/eureka,http://eureka7001.com:7001/eureka/ #集群版
  7. #defaultZone: http://eureka7001.com:7001/eureka/
  8. # 加上
  9. instance:
  10. instance-id: payment8090

修改配置后显示的主机名称

1610803428679.png

访问信息有ip信息提示

改配置文件yml

eureka:
  client:
    register-with-eureka: true
    fetch-registry: true
    service-url:
      defaultZone: http://eureka7002.com:7002/eureka,http://eureka7001.com:7001/eureka/ #集群版
      #defaultZone: http://eureka7001.com:7001/eureka/
  instance:
    instance-id: payment8091
    prefer-ip-address: true #访问路径可以显示ip地址

改后的效果图

1610803428724.png