如果一台电脑存在多个网关(多个虚拟ip),这种情况多出现于,电脑有虚拟机或者同时连接内外网的配置情况
出现ipconfig的情况下有多个ip地址,注册到注册中心时可能不是自己想指定的ip地址,需要在application.yml文件加一行配置
ipAddress: 172.16.130.107
示例如下:
server:
port: 8058
servlet.contextPath: /test-login
eureka:
client:
enabled: true
serviceUrl:
defaultZone: http://192.168.11.55:8071/eureka/
instance:
preferIpAddress: true
ipAddress: 192.168.11.107
leaseRenewalIntervalInSeconds: 5
leaseExpirationDurationInSeconds: 5
instance-id: ${spring.cloud.client.ipAddress}:${spring.application.name}:${server.port}
spring:
cloud:
loadbalancer:
retry:
enabled: false
application:
name: test-login