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. Building a Keras + deep learning REST API(三部曲之一)

    一.基本环境 )     image = imagenet_utils.preprocess_input(image)     , ))             ]:                  ...

  2. 辅助模块:udp_sweep

    辅助模块:udp_sweep 模块介绍 使用udp对指定IP地址主机进行udp扫描 实践过程 利用该模块填写目的IP来对目的IP地址进行扫描 从结果可以看到扫描结果显示扫描过程放出了13个探针,发现了 ...

  3. 【Python54.1--豆瓣登录】

    1.模拟豆瓣登录 ''' |-- 代码解析: |-- 1.登录必须具备的条件:url,cookie,fromData fromData的参数如下: source: index_nav form_ema ...

  4. 【Python042--魔法方法:算术运算】

    一.算术魔法方法的举例 1.加法(__add__)的算术运算调用减法(__sub__)的算术运算,减法(__sub__)的算术运算调用加法(__add__)的算术运算 class New_Init(i ...

  5. python操作串口

    import serial test = serial.Serial("COM1",115200)#这里就已经打开了串口 print(test.portstr) test.writ ...

  6. 【POJ1961】period

    [POJ1961]period 题目描述 如果一个字符串S是由一个字符串T重复K次构成的,则称T是S的循环元.使K出现最大的字符串T称为S的最小循环元,此时的K称为最大循环次数. 现在给定一个长度为N ...

  7. k倍区间 前缀和【蓝桥杯2017 C/C++ B组】

    标题: k倍区间 给定一个长度为N的数列,A1, A2, ... AN,如果其中一段连续的子序列Ai, Ai+1, ... Aj(i <= j)之和是K的倍数,我们就称这个区间[i, j]是K倍 ...

  8. c# Database类的使用

    参考资料http://ansonlh.iteye.com/blog/1689009 搜索:c# DatabaseFactory类

  9. 题解——洛谷P2613 【模板】有理数取余(扩展欧几里得算法+逆元)

    题面 题目描述 给出一个有理数 c=\frac{a}{b}  ​ ,求  c mod19260817  的值. 输入输出格式 输入格式: 一共两行. 第一行,一个整数 \( a \) .第二行,一个整 ...

  10. IE10 解决input file 同一文件不触发onchange事件

    if (window.ActiveXObject) { var reg = /10\.0/; var str = navigator.userAgent; if (reg.test(str)) { v ...