服务网关(Zuul)

  • Dynamic Routing 动态路由
  • Security 监控与审查
  • Authentication 身份认证与安全
  • Stress Testing 压力测试: 逐渐增加某一个服务集群的流量,以了解服务性能;
  • Canary Testing金丝雀测试
  • Service Migration服务迁移
  • Load Shedding 负载剪裁: 为每一个负载类型分配对应的容量,对超过限定值的请求弃用;
  • Static Response handling 静态应答处理
  • Active/Active traffic management
  • Insights

Spring Cloud 2021.0.1 移除了Hystrix、Zuul等Netflix组件

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

    <modelVersion>4.0.0</modelVersion>

    <artifactId>dms-cloud-zuul</artifactId>
    <groupId>cn.dails</groupId>
    <version>1.0-SNAPSHOT</version>
    <parent>
        <groupId>cn.dails</groupId>
        <artifactId>dails-parent</artifactId>
        <version>1.0-SNAPSHOT</version>
        <relativePath></relativePath>
    </parent>

    <properties>
        <maven.compiler.source>8</maven.compiler.source>
        <maven.compiler.target>8</maven.compiler.target>
<!--        <spring-boot.version>2.3.12.RELEASE</spring-boot.version>-->
<!--        <spring-cloud.version>Hoxton.SR12</spring-cloud.version>-->
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
<!--            <version>2.2.9.RELEASE</version>-->
        </dependency>

        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-netflix-zuul</artifactId>
            <version>2.2.9.RELEASE</version>
        </dependency>
    </dependencies>
    <build>
        <finalName>dms-zuul</finalName>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <version>${spring-boot.version}</version>
            </plugin>
        </plugins>
    </build>
</project>

这里面spring-cloud-starter-netflix-zuul 已经需要指定version了

yml

server:
  port: 18088
  base-uri-code: zuul
spring:
  application:
    name: dms-zuul

eureka:
  client:
    serviceUrl:
      defaultZone: http://localhost:8088/eureka/

zuul:
  routes:
    dms-user:
      stripPrefix: false
      path: /user/**
      serviceId: dms-user
    dms-asset:
      stripPrefix: false
      path: /asset/**
      serviceId: dms-asset

ZuulApplication

package cn.dms;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.netflix.zuul.EnableZuulProxy;

@SpringBootApplication
@EnableZuulProxy
@EnableEurekaClient
@EnableDiscoveryClient
public class ZuulApplication {

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

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值