zoukankan      html  css  js  c++  java
  • 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);

    }

    }

  • 相关阅读:
    js-数组的原型拓展
    java-单例模式的java连接池
    java-基本数据类型值范围
    rabbitmq
    从哪跌倒从哪爬起,千里之行始于足下
    create python project steps
    常用代码片段
    shell脚本常用(记)
    shell学习
    maven工具使用
  • 原文地址:https://www.cnblogs.com/niexinlei/p/9720363.html
Copyright © 2011-2022 走看看