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

实例:

1:添加依赖pom.xml:

<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-zuul</artifactId>
</dependency>
</dependencies>

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);

}

}

最新文章

  1. 如何使用android百度地图离线地图
  2. spring4+websocket+nginx详细配置
  3. CSS 文字两端对齐
  4. Dockerfile指令
  5. lucene入门
  6. 移动h5自适应布局
  7. HDU 5074 Luck Competition (暴力,概率)
  8. hadoop2.5发布:最新编译 32位、64位安装、源码包、API以及新特性
  9. 为Dapper编写一个类似于EF的Map配置类
  10. [转载]Android 知识图谱
  11. gaoyong的干货
  12. lightoj1038(期望dp)
  13. ASP.NET 5 Identity
  14. [.net 面向对象程序设计深入](13)实战设计模式——设计模式使用场景及原则
  15. 【mysql】工作中mysql常用命令及语句
  16. Spring Boot系列——AOP配自定义注解的最佳实践
  17. C语言函数的存储类别
  18. HDU 4557 Tree(可持久化字典树 + LCA)
  19. 【链表】Linked List Cycle II
  20. 解决一个java facets问题

热门文章

  1. Codeforces1301D
  2. 若块级元素被设置为 display: table-cell 便无法设置宽度
  3. SRSniffer抓包工具的使用
  4. UniGui学习之部署(06)只 有Loading...,
  5. leetcode295 Find Median from Data Stream
  6. css选择器优先级排序
  7. hdu 1086 You can Solve a Geometry Problem too 求n条直线交点的个数
  8. C#用SQLDMO操作数据库----转载
  9. 【剑指Offer面试编程题】题目1511:从尾到头打印链表--九度OJ
  10. 如何确定Redis集群中各个节点的主从关系