application.yml
如果是多台服務器
spring:
application:
name: api-gateway
server:
port: 8007
zuul:
routes:
user-service:
path: /user-service/**
serviceId: user-service2
ribbon:
eureka:
enabled: true
user-service2:
ribbon:
listOfServers: http://localhost:8003/,http://localhost:8004/
eureka:
client:
serviceUrl:
defaultZone: http://localhost:8002/eureka/
在Spring Cloud Zuul中使用Ribbon 作為負載均衡器,
如果是單台機器,不使用負載均衡,配置就簡單了:
spring:
application:
name: api-gateway
server:
port: 8007
zuul:
routes:
user-service:
path: /user-service/**
url: http://localhost:8003
eureka:
client:
serviceUrl:
defaultZone: http://localhost:8002/eureka/