最新的Spring Cloud获取本机的IP地址的配置文件如下:
eureka:
instance:
hostname: ${spring.cloud.client.ip-address}
lease-renewal-interval-in-seconds: 30 # 服务续约任务的调用间隔时间,默认30秒
lease-expiration-duration-in-seconds: 90 # 服务失效时间,默认90秒
prefer-ip-address: true
instance-id: ${spring.cloud.client.ip-address}:${server.port}