springcloud--ruul(路由网关)
2021-06-17 13:05
标签:依赖 provider host [] 过滤 过滤器 服务 hello enable
Zuul的主要功能就是路由转发和过滤器
实例:
1:添加依赖pom.xml:
spring-cloud-starter-netflix-eureka-client
spring-boot-starter-actuator
spring-cloud-starter-netflix-zuul
2:配置文件:
server:
port: 8888
spring:
application:
name: zuul-gateway
eureka:
client:
service-url:
defaultZone: http://localhost:9001/eureka/
instance:
instance-id: zuul-8888
prefer-ip-address: true
zuul:
prefix: /nxl
ignored-services: "*" #屏蔽指定的服务
routes:
hello-route:
#微服务名字,提供者的名字
service-id: provider-one
path: /aaa/**
3:启动类:
@SpringBootApplication
@EnableZuulProxy
public class App {
public static void main(String[] args) {
SpringApplication.run(App.class, args);
}
}
springcloud--ruul(路由网关)
标签:依赖 provider host [] 过滤 过滤器 服务 hello enable
原文地址:https://www.cnblogs.com/niexinlei/p/9720363.html
文章标题:springcloud--ruul(路由网关)
文章链接:http://soscw.com/index.php/essay/95056.html