springcloud--ruul(路由网关)
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);
}
}
最新文章
- 如何使用android百度地图离线地图
- spring4+websocket+nginx详细配置
- CSS 文字两端对齐
- Dockerfile指令
- lucene入门
- 移动h5自适应布局
- HDU 5074 Luck Competition (暴力,概率)
- hadoop2.5发布:最新编译 32位、64位安装、源码包、API以及新特性
- 为Dapper编写一个类似于EF的Map配置类
- [转载]Android 知识图谱
- gaoyong的干货
- lightoj1038(期望dp)
- ASP.NET 5 Identity
- [.net 面向对象程序设计深入](13)实战设计模式——设计模式使用场景及原则
- 【mysql】工作中mysql常用命令及语句
- Spring Boot系列——AOP配自定义注解的最佳实践
- C语言函数的存储类别
- HDU 4557 Tree(可持久化字典树 + LCA)
- 【链表】Linked List Cycle II
- 解决一个java facets问题
热门文章
- Codeforces1301D
- 若块级元素被设置为 display: table-cell 便无法设置宽度
- SRSniffer抓包工具的使用
- UniGui学习之部署(06)只 有Loading...,
- leetcode295 Find Median from Data Stream
- css选择器优先级排序
- hdu 1086 You can Solve a Geometry Problem too 求n条直线交点的个数
- C#用SQLDMO操作数据库----转载
- 【剑指Offer面试编程题】题目1511:从尾到头打印链表--九度OJ
- 如何确定Redis集群中各个节点的主从关系