使用Zuul

建立一个maven
pom.xml导入`
org.springframework.cloud
spring-cloud-starter-zuul

		
		org.springframework.cloud
		spring-cloud-starter-eureka
	`

application.yml配置如下`server:
port: 8082

spring:
application:
name: TestZuul

eureka:
client:
serviceUrl:
defaultZone: http://localhost:8520/eureka/

zuul:
routes:
api-a:
url: http://localhost:8080/
path: /user/**
service-id: TestBoot
strip-prefix: false`
其中zuul的URL代表要关联的子服务器端口,service-id表示端口的名字,即hostname

你可能感兴趣的:(使用Zuul)