如何自定义微服务的Instance ID
本文我们来探讨如何自定义微服务的Intance ID。Instance ID用于唯一标识注册到Eureka Server上的微服务实例。 我们可在Eureka Server的首页直观地看到各个微服务的Instance ID。例如,图11-1中的itmuch:microservice-provider-user:8000 就是Intance ID。 11-1.png 图11-1 Eureka Server上的微服务列表 在Spring Cloud中,服务的Instance ID的默认值是${spring.cloud.client.hostname}:${spring.application.name}:${spring.application.instance_id:${server.port}} 。如果想要自定义这部分的内容,只需在微服务中配置eureka.instance.instance-id 属性即可,例如: spring: application: name: microservice-provider-user eureka: instance: instance-id: $...