spring cloud: zuul: 微网关-简单使用与路由配置

首先引入依赖

<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-zuul</artifactId>
</dependency> <dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-eureka</artifactId>
</dependency>

  

入口文件加入@EnableZuulProxy注解

@EnableZuulProxy
@SpringBootApplication
public class ZuulApplication { public static void main(String[] args) {
SpringApplication.run(ZuulApplication.class, args);
}
}

  

application.properties

server.port = 8040
#spring
spring.application.name=spring-boot-zuul
#localhost
#user.userServicePath=http://localhost:7900/simple/
#eureka
eureka.client.healthcheck.enable=true
eureka.client.serviceurl.defaultzone=http://localhost:8761/eureka
eureka.instance.preferIpAddress=true #ip

  

启动zuul服务,eureka服务,user服务

访问:

http://192.168.1.4:8040/spring-boot-movie-ribbon/movie/1

http://192.168.1.4:8040/spring-boot-user/simple/3

二。配置zuul路由

application.properties

zuul.routes.spring-boot-user=/user/**

  

启动,访问

spring cloud: zuul: 微网关-简单使用与路由配置的更多相关文章

  1. Spring Cloud Zuul与网关中间件

    Spring Cloud Zuul与网关中间件_网易订阅 http://dy.163.com/v2/article/detail/DC7L8UV10511HSJK.html

  2. 如何Spring Cloud Zuul作为网关的分布式系统中整合Swagger文档在同一个页面上

    本文不涉及技术,只是单纯的一个小技巧. 阅读本文前,你需要对spring-cloud-zuul.spring-cloud-eureka.以及swagger的配置和使用有所了解. 如果你的系统也是用zu ...

  3. Spring Cloud Gateway实战之二:更多路由配置方式

    欢迎访问我的GitHub https://github.com/zq2599/blog_demos 内容:所有原创文章分类汇总及配套源码,涉及Java.Docker.Kubernetes.DevOPS ...

  4. 微服务架构下使用Spring Cloud Zuul作为网关将多个微服务整合到一个Swagger服务上

    注意: 如果你正在研究微服务,那必然少不了服务之间的相互调用,哪么服务之间的接口以及api就必须生成系统的管理文档了.如果你希望更好的管理你的API,你希望有一个工具能一站式地解决API相关的所有事情 ...

  5. Spring Cloud Alibaba微服务一站式解决方案-开篇v2.2.1.RELEASE

    学习路线 **本人博客网站 **IT小神 www.itxiaoshen.com 生态概述 架构演进 什么是微服务 https://martinfowler.com/microservices/ Mic ...

  6. Spring Cloud Alibaba微服务架构入门最容易理解篇

    微服务架构介绍 Spring Cloud Alibaba推荐的微服务生态架构基于分层架构实现如下: 接入层:最外层为LVS+Keepalived,可承受几十万级高并发流量洪峰,然后再通过内层的ngin ...

  7. Spring Boot + Spring Cloud 构建微服务系统(七):API服务网关(Zuul)

    技术背景 前面我们通过Ribbon或Feign实现了微服务之间的调用和负载均衡,那我们的各种微服务又要如何提供给外部应用调用呢. 当然,因为是REST API接口,外部客户端直接调用各个微服务是没有问 ...

  8. Spring Cloud Zuul API服务网关之请求路由

    目录 一.Zuul 介绍 二.构建Spring Cloud Zuul网关 构建网关 请求路由 请求过滤 三.路由详解 一.Zuul 介绍 ​ 通过前几篇文章的介绍,我们了解了Spring Cloud ...

  9. Spring Cloud Zuul性能调整

    Spring Cloud 版本: Dalston.SR5 这两天通过JMeter测了一下Spring Cloud Zuul的性能,用的是两台虚机8核8G和4核8G,宿主机是10核逻辑20核,代理的服务 ...

随机推荐

  1. Linux下的查找技巧

    Find知识点: -mtime ——修改时间 -ctime ——创建时间 -atime ——访问时间 mtime 举例说明: -mtime n : n为数字,意思为在n天之前的“一天之内”被更改过内容 ...

  2. SVM学习笔记3-问题转化

    在1中,我们的求解问题是:$min_{w,b}$ $\frac{1}{2}||w||^{2}$,使得$y^{(i)}(w^{T}x^{(i)}+b)\geq 1 ,1 \leq i \leq n$ 设 ...

  3. 那些离不开的 Chrome 扩展插件

    虽然Chrome浏览器是个吃内存的怪兽,但是,它却因为启动速度.调试功能等成为了程序猿的必备浏览器!今天有时间,整理一下自己最常用的一些Chrome扩展吧: 常用网页浏览非开发类扩展: Tamperm ...

  4. Git rebase使用

    目录 rebase的优点和缺点 分支内合并多个commit为一个新commit使用: 命令: 使用: 将其他分支合并到主分支,表现为线性: 将其他分支多个commit合并到主分支,并形成一个新comm ...

  5. FJNU2018低程F jq解救fuls (贪心乱搞)题解

    题目描述 一天fuls被邪恶的"咕咕咕"抓走了,jq为了救fuls可谓是赴汤蹈火,费了九牛二虎之力才找到了"咕咕咕"关押fuls的地方. fuls被关在一个机关 ...

  6. SQL优化参考

    1.对查询进行优化,要尽量避免全表扫描,首先应考虑在 where 及 order by 涉及的列上建立索引. 2.应尽量避免在 where 子句中对字段进行 null 值判断,否则将导致引擎放弃使用索 ...

  7. P3261 [JLOI2015]城池攻占

    思路 左偏树维护每个骑士的战斗力和加入的深度(因为只能向上跳) 注意做乘法的时候加法tag会受到影响 代码 #include <cstdio> #include <algorithm ...

  8. (转)Understanding, generalisation, and transfer learning in deep neural networks

    Understanding, generalisation, and transfer learning in deep neural networks FEBRUARY 27, 2017   Thi ...

  9. java.lang.OutOfMemoryError:GC overhead limit exceeded

    在调测程序时报java.lang.OutOfMemoryError:GC overhead limit exceeded 错误 错误原因:在用程序进行数据切割时报了该错误.由于在本地执行数据切割测试的 ...

  10. ActiveReports 大数据分析报告:公交车司乘冲突引发的刑事案件

    公交车司乘冲突刑事案件总体情况 公交车司乘冲突引发的刑事案件总量稳中有升 (注:本报告界定的“公交车司乘冲突刑事案件”,是指案件诱因为公交车司机与乘客在乘车过程中发生冲突而引发的刑事案件.包括但不限于 ...