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. opencv学习之路(11)、图像几何变换

    一.图像缩放 #include<opencv2/opencv.hpp> using namespace cv; void main(){ Mat src=imread("E:// ...

  2. 支持图片上传预览的 uploadPreview.js 插件

    原文链接:http://www.lanrenzhijia.com/others/3148.html

  3. JQuery 实现 倒计时 按钮具体方法

    <head> <title>test count down button</title> <script src="http://ajax.aspn ...

  4. 【4opencv】CLR基本原理和如何运用于GOCW

    GOCW的重点和难点就在于Csharp调用OpenCV,其中的桥梁就是CLR,当然我们也有其他方法,但是CLR是一个比较新的.比较可靠的.关键是能用的桥梁.这里关于CLR的基本原理知识.如何用于GOC ...

  5. batchGetAnchorLevel(dubbo接口)

    一.编写脚本前的准备工作 1.安装idea,安装本地maven库,并在idea里面配置maven 2.导入git源码(目的在于下载所依赖的基础包)-->File-new-Project from ...

  6. 【python011--数组2】

    一.从列表中获取元素 *跟数组一样,我们可以通过元素的索引值(index)从列表获取单个元素,注意,列表索引值是从0开始的 >>> member= ['尘封','冰点','无名',' ...

  7. 如何在Framework中读取bundle中的Res

    前因: 因为公司上架前后的原因,外围的平台层部分提前上线,而我做的功能部分需要晚一些上线,是单独的一个工程在其他仓库开发. 我的资源文件放在Bundle中.合到主工程中,资源文件不用改,直接拖进去.倒 ...

  8. openwrt支持哪些c库?

    答: 至2019/3/22,支持两种,一种是glibc,另一种是musl-libc(openwrt默认使用musl-libc)

  9. POJ 1751 Highways 【最小生成树 Kruskal】

    Highways Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 23070   Accepted: 6760   Speci ...

  10. jvm:垃圾收集器

    垃圾收集器: Serial 收集器: 单线程收集器,专注做收集,会暂停别的工作.收集效果好. ParNew 收集器: 是Serial的多线程版本.目前只有它能和CMS收集器配合.    Paralle ...