springcloud--ruul(路由网关)

2021-06-17 13:05

阅读:395

标签:依赖   provider   host   []   过滤   过滤器   服务   hello   enable   

Zuul的主要功能就是路由转发和过滤器

实例:

1:添加依赖pom.xml:



org.springframework.cloud
spring-cloud-starter-netflix-eureka-client


org.springframework.boot
spring-boot-starter-actuator


org.springframework.cloud
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


评论


亲,登录后才可以留言!