1.依赖
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
</dependency>
<!-- 服务网关 -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-zuul</artifactId>
</dependency>
2.配置
server:
port: 9000
spring:
application:
name: ad-gateway
eureka:
client:
service-url:
defaultZone: http://server1:8000/eureka/
3.启动类添加注解
@EnableZuulProxy
@SpringCloudApplication