Spring Cloud入门-Gateway服务网关(Hoxton版本)

Spring Cloud入门-Gateway服务网关(Hoxton版本),linux教程入门教程PDF 这里我们创建一个api-gateway模块来演示Gateway的常用功能。 在pom.xml中添加相关依赖 org.springframework.cloud spring-cloud-starter-gateway 两种不同的配置路由方式 Gateway 提供了两种不同的方式用于配置路由,一种是通过yml文件来配置,另一种是通过Java Bean来配置,下面我们分别介绍下。 使用yml配置 在application.yml中进行配置: server: port: 9201 service-ur. 阅读详情

项目使用的Spring Cloud为Hoxton版本,Spring Boot为2.2.2.RELEASE版本

Spring Cloud入门系列汇总

序号内容链接地址
1Spring Cloud入门-十分钟了解Spring Cloudhttps://blog.youkuaiyun.com/ThinkWon/article/details/103715146
2Spring Cloud入门-Eureka服务注册与发现(Hoxton版本)https://blog.youkuaiyun.com/ThinkWon/article/details/103726655
3Spring Cloud入门-Ribbon服务消费者(Hoxton版本)https://blog.youkuaiyun.com/ThinkWon/article/details/103729080
4Spring Cloud入门-Hystrix断路器(Hoxton版本)https://blog.youkuaiyun.com/ThinkWon/article/details/103732497
5Spring Cloud入门-Hystrix Dashboard与Turbine断路器监控(Hoxton版本)https://blog.youkuaiyun.com/ThinkWon/article/details/103734664
6Spring Cloud入门-OpenFeign服务消费者(Hoxton版本)https://blog.youkuaiyun.com/ThinkWon/article/details/103735751
7Spring Cloud入门-Zuul服务网关(Hoxton版本)https://blog.youkuaiyun.com/ThinkWon/article/details/103738851
8Spring Cloud入门-Config分布式配置中心(Hoxton版本)https://blog.youkuaiyun.com/ThinkWon/article/details/103739628
9Spring Cloud入门-Bus消息总线(Hoxton版本)https://blog.youkuaiyun.com/ThinkWon/article/details/103753372
10Spring Cloud入门-Sleuth服务链路跟踪(Hoxton版本)https://blog.youkuaiyun.com/ThinkWon/article/details/103753896
11Spring Cloud入门-Consul服务注册发现与配置中心(Hoxton版本)https://blog.youkuaiyun.com/ThinkWon/article/details/103756139
12Spring Cloud入门-Gateway服务网关(Hoxton版本)https://blog.youkuaiyun.com/ThinkWon/article/details/103757927
13Spring Cloud入门-Admin服务监控中心(Hoxton版本)https://blog.youkuaiyun.com/ThinkWon/article/details/103758697
14Spring Cloud入门-Oauth2授权的使用(Hoxton版本)https://blog.youkuaiyun.com/ThinkWon/article/details/103761687
15Spring Cloud入门-Oauth2授权之JWT集成(Hoxton版本)https://blog.youkuaiyun.com/ThinkWon/article/details/103763364
16Spring Cloud入门-Oauth2授权之基于JWT完成单点登录(Hoxton版本)https://blog.youkuaiyun.com/ThinkWon/article/details/103766368
17Spring Cloud入门-Nacos实现注册和配置中心(Hoxton版本)https://blog.youkuaiyun.com/ThinkWon/article/details/103769680
18Spring Cloud入门-Sentinel实现服务限流、熔断与降级(Hoxton版本)https://blog.youkuaiyun.com/ThinkWon/article/details/103770879
19Spring Cloud入门-Seata处理分布式事务问题(Hoxton版本)https://blog.youkuaiyun.com/ThinkWon/article/details/103786102
20Spring Cloud入门-汇总篇(Hoxton版本)https://blog.youkuaiyun.com/ThinkWon/article/details/103786588

摘要

Spring Cloud Gateway 为 SpringBoot 应用提供了API网关支持,具有强大的智能路由与过滤器功能,本文将对其用法进行详细介绍。

Gateway 简介

Gateway是在Spring生态系统之上构建的API网关服务,基于Spring 5,Spring Boot 2和 Project Reactor等技术。Gateway旨在提供一种简单而有效的方式来对API进行路由,以及提供一些强大的过滤器功能, 例如:熔断、限流、重试等。

Spring Cloud Gateway 具有如下特性:

  • 基于Spring Framework 5, Project Reactor 和 Spring Boot 2.0 进行构建;
  • 动态路由:能够匹配任何请求属性;
  • 可以对路由指定 Predicate(断言)和 Filter(过滤器);
  • 集成Hystrix的断路器功能;
  • 集成 Spring Cloud 服务发现功能;
  • 易于编写的 Predicate(断言)和 Filter(过滤器);
  • 请求限流功能;
  • 支持路径重写。

相关概念

  • Route(路由):路由是构建网关的基本模块,它由ID,目标URI,一系列的断言和过滤器组成,如果断言为true则匹配该路由;
  • Predicate(断言):指的是Java 8 的 Function Predicate。 输入类型是Spring框架中的ServerWebExchange。 这使开发人员可以匹配HTTP请求中的所有内容,例如请求头或请求参数。如果请求与断言相匹配,则进行路由;
  • Filter(过滤器):指的是Spring框架中GatewayFilter的实例,使用过滤器,可以在请求被路由前后对请求进行修改。

创建 api-gateway模块

这里我们创建一个api-gateway模块来演示Gateway的常用功能。

在pom.xml中添加相关依赖

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

两种不同的配置路由方式

Gateway 提供了两种不同的方式用于配置路由,一种是通过yml文件来配置,另一种是通过Java Bean来配置,下面我们分别介绍下。

使用yml配置

在application.yml中进行配置:

server:
  port: 9201

service-url:
  user-service: http://localhost:8201

spring:
  cloud:
    gateway:
      routes:
          # 路由的ID
        - id: path_route
          # 匹配后路由地址
          uri: ${service-url.user-service}/user/{id}
          predicates:
              # 断言,路径相匹配的进行路由
            - Path=/user/{id}

启动eureka-server、user-service和api-gateway服务,并调用该地址测试:http://localhost:9201/user/1

我们发现该请求被路由到了user-service的该路径上:http://localhost:8201/user/1

在这里插入图片描述

使用Java Bean配置

添加相关配置类,并配置一个RouteLocator对象:

@Configuration
public class GatewayConfig {

    @Bean
    public RouteLocator customerRouteLocator(RouteLocatorBuilder builder) {
        return builder.routes()
                .route("path_route2", r -> r.path("/user/getByUsername")
                        .uri("http://localhost:8201/user/getByUsername"))
                .build();
    }

}

重新启动api-gateway服务,并调用该地址测试:http://localhost:9201/user/getByUsername?username=jourwon

我们发现该请求被路由到了user-service的该路径上:http://localhost:8201/user/getByUsername?username=jourwon

在这里插入图片描述

Route Predicate 的使用

Spring Cloud Gateway将路由匹配作为Spring WebFlux HandlerMapping基础架构的一部分。 Spring Cloud Gateway包括许多内置的Route Predicate工厂。 所有这些Predicate都与HTTP请求的不同属性匹配。 多个Route Predicate工厂可以进行组合,下面我们来介绍下一些常用的Route Predicate。

注意:Predicate中提到的配置都在application-predicate.yml文件中进行修改,并用该配置启动api-gateway服务。

After Route Predicate

在指定时间之后的请求会匹配该路由。

spring:
  cloud:
    gateway:
      routes:
        - id: after_route
          uri: ${service-url.user-service}
          predicates:
            - After=2019-12-29T18:30:00+08:00[Asia/Shanghai]

Before Route Predicate

在指定时间之前的请求会匹配该路由。

spring:
  cloud:
    gateway:
      routes:
        - id: before_route
          uri: ${service-url.user-service}
          predicates:
            - Before=2019-12-29T18:30:00+08:00[Asia/Shanghai]

Between Route Predicate

在指定时间区间内的请求会匹配该路由。

spring:
  cloud:
    gateway:
      routes:
        - id: before_route
          uri: ${service-url.user-service}
          predicates:
            - Between=2019-12-29T18:30:00+08:00[Asia/Shanghai], 2019-12-30T18:30:00+08:00[Asia/Shanghai]

Cookie Route Predicate

带有指定Cookie的请求会匹配该路由。

spring:
  cloud:
    gateway:
      routes:
        - id: cookie_route
          uri: ${service-url.user-service}
          predicates:
            - Cookie=username,jourwon

使用curl工具发送带有cookie为username=jourwon的请求可以匹配该路由。

curl http://localhost:9201/user/1 --cookie "username=jourwon"

Header Route Predicate

带有指定请求头的请求会匹配该路由。

spring:
  cloud:
    gateway:
      routes:
      - id: header_route
        uri: ${service-url.user-service}
        predicates:
        - Header=X-Request-Id, \d+

使用curl工具发送带有请求头为X-Request-Id:123的请求可以匹配该路由。

curl http://localhost:9201/user/1 -H "X-Request-Id:123" 

Host Route Predicate

带有指定Host的请求会匹配该路由。

spring:
  cloud:
    gateway:
      routes:
        - id: host_route
          uri: ${service-url.user-service}
          predicates:
            - Host=**.jourwon.com

使用curl工具发送带有请求头为Host:www.jourwon.com的请求可以匹配该路由。

curl http://localhost:9201/user/1 -H "Host:www.jourwon.com" 

Method Route Predicate

发送指定方法的请求会匹配该路由。

spring:
  cloud:
    gateway:
      routes:
      - id: method_route
        uri: ${service-url.user-service}
        predicates:
        - Method=GET

使用curl工具发送GET请求可以匹配该路由。

curl http://localhost:9201/user/1

使用curl工具发送POST请求无法匹配该路由。

curl -X POST http://localhost:9201/user/1

Path Route Predicate

发送指定路径的请求会匹配该路由。

spring:
  cloud:
    gateway:
      routes:
        - id: path_route
          uri: ${service-url.user-service}/user/{id}
          predicates:
            - Path=/user/{id}

使用curl工具发送/user/1路径请求可以匹配该路由。

curl http://localhost:9201/user/1

使用curl工具发送/abc/1路径请求无法匹配该路由。

curl http://localhost:9201/abc/1

Query Route Predicate

带指定查询参数的请求可以匹配该路由。

spring:
  cloud:
    gateway:
      routes:
      - id: query_route
        uri: ${service-url.user-service}/user/getByUsername
        predicates:
        - Query=username

使用curl工具发送带username=jourwon查询参数的请求可以匹配该路由。

curl http://localhost:9201/user/getByUsername?username=jourwon

使用curl工具发送带不带查询参数的请求无法匹配该路由。

curl http://localhost:9201/user/getByUsername

RemoteAddr Route Predicate

从指定远程地址发起的请求可以匹配该路由。

spring:
  cloud:
    gateway:
      routes:
      - id: remoteaddr_route
        uri: ${service-url.user-service}
        predicates:
        - RemoteAddr=192.168.1.1/24

使用curl工具从192.168.1.1发起请求可以匹配该路由。

curl http://localhost:9201/user/1

Weight Route Predicate

使用权重来路由相应请求,以下表示有80%的请求会被路由到localhost:8201,20%会被路由到localhost:8202。

spring:
  cloud:
    gateway:
      routes:
      - id: weight_high
        uri: http://localhost:8201
        predicates:
        - Weight=group1, 8
      - id: weight_low
        uri: http://localhost:8202
        predicates:
        - Weight=group1, 2

Route Filter 的使用

路由过滤器可用于修改进入的HTTP请求和返回的HTTP响应,路由过滤器只能指定路由进行使用。Spring Cloud Gateway 内置了多种路由过滤器,他们都由GatewayFilter的工厂类来产生,下面我们介绍下常用路由过滤器的用法。

AddRequestParameter GatewayFilter

给请求添加参数的过滤器。

spring:
  cloud:
    gateway:
      routes:
        - id: add_request_parameter_route
          uri: http://localhost:8201
          filters:
            - AddRequestParameter=username, jourwon
          predicates:
            - Method=GET

以上配置会对GET请求添加username=jourwon的请求参数,通过curl工具使用以下命令进行测试。

curl http://localhost:9201/user/getByUsername

相当于发起该请求:

curl http://localhost:8201/user/getByUsername?username=jourwon

StripPrefix GatewayFilter

对指定数量的路径前缀进行去除的过滤器。

spring:
  cloud:
    gateway:
      routes:
      - id: strip_prefix_route
        uri: http://localhost:8201
        predicates:
        - Path=/user-service/**
        filters:
        - StripPrefix=2

以上配置会把以/user-service/开头的请求的路径去除两位,通过curl工具使用以下命令进行测试。

curl http://localhost:9201/user-service/a/user/1

相当于发起该请求:

curl http://localhost:8201/user/1

PrefixPath GatewayFilter

与StripPrefix过滤器恰好相反,会对原有路径进行增加操作的过滤器。

spring:
  cloud:
    gateway:
      routes:
      - id: prefix_path_route
        uri: http://localhost:8201
        predicates:
        - Method=GET
        filters:
        - PrefixPath=/user

以上配置会对所有GET请求添加/user路径前缀,通过curl工具使用以下命令进行测试。

curl http://localhost:9201/1

相当于发起该请求:

curl http://localhost:8201/user/1

Hystrix GatewayFilter

Hystrix 过滤器允许你将断路器功能添加到网关路由中,使你的服务免受级联故障的影响,并提供服务降级处理。

要开启断路器功能,我们需要在pom.xml中添加Hystrix的相关依赖:

<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-starter-netflix-hystrix</artifactId>
</dependency>

然后添加相关服务降级的处理类:

@RestController
public class FallbackController {

    @GetMapping("/fallback")
    public Object fallback() {
        Map<String,Object> result = new HashMap<>();
        result.put("data",null);
        result.put("message","Get request fallback!");
        result.put("code",500);
        return result;
    }


}

在application-filter.yml中添加相关配置,当路由出错时会转发到服务降级处理的控制器上:

spring:
  cloud:
    gateway:
      routes:
        - id: hystrix_route
          uri: ${service-url.user-service}
          predicates:
            - Method=GET
          filters:
            - name: Hystrix
              args:
                name: fallbackcmd
                fallback-uri: forward:/fallback

关闭user-service,调用该地址进行测试:http://localhost:9201/user/1 ,发现已经返回了服务降级的处理信息。

在这里插入图片描述

RequestRateLimiter GatewayFilter

RequestRateLimiter 过滤器可以用于限流,使用RateLimiter实现来确定是否允许当前请求继续进行,如果请求太大默认会返回HTTP 429-太多请求状态。

在pom.xml中添加相关依赖:

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-data-redis-reactive</artifactId>
</dependency>

添加限流策略的配置类,这里有两种策略一种是根据请求参数中的username进行限流,另一种是根据访问IP进行限流;

@Configuration
public class RedisRateLimiterConfig {

    @Bean
    public KeyResolver userKeyResolver() {
        return exchange -> Mono.just(exchange.getRequest().getQueryParams().getFirst("username"));
    }


    @Bean
    public KeyResolver ipKeyResolver() {
        return exchange -> Mono.just(exchange.getRequest().getRemoteAddress().getHostName());
    }


}

我们使用Redis来进行限流,所以需要添加Redis和RequestRateLimiter的配置,这里对所有的GET请求都进行了按IP来限流的操作;

spring:
  redis:
    host: localhost
    password: 123456
    port: 6379
  cloud:
    gateway:
      routes:
        - id: requestratelimiter_route
          uri: http://localhost:8201
          filters:
            - name: RequestRateLimiter
              args:
                # 每秒允许处理的请求数量
                redis-rate-limiter.replenishRate: 1
                # 每秒最大处理的请求数量
                redis-rate-limiter.burstCapacity: 2
                # 限流策略,对应策略的Bean
                key-resolver: "#{@ipKeyResolver}"
          predicates:
            - Method=GET

logging:
  level:
    org.springframework.cloud.gateway: debug

多次请求该地址:http://localhost:9201/user/1 ,会返回状态码为429的错误;

在这里插入图片描述

Retry GatewayFilter

对路由请求进行重试的过滤器,可以根据路由请求返回的HTTP状态码来确定是否进行重试。

修改配置文件:

spring:
  cloud:
    gateway:
      routes:
      - id: retry_route
        uri: http://localhost:8201
        predicates:
        - Method=GET
        filters:
        - name: Retry
          args:
            retries: 1 #需要进行重试的次数
            statuses: BAD_GATEWAY #返回哪个状态码需要进行重试,返回状态码为5XX进行重试
            backoff:
              firstBackoff: 10ms
              maxBackoff: 50ms
              factor: 2
              basedOnPreviousValue: false

当调用返回500时会进行重试,访问测试地址:http://localhost:9201/user/111

可以发现user-service控制台报错2次,说明进行了一次重试。

2019-12-29 19:09:30.003 ERROR [user-service,,,] 2316 --- [nio-8201-exec-1] o.a.c.c.C.[.[.[/].[dispatcherServlet]    : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is java.lang.NullPointerException] with root cause

java.lang.NullPointerException: null

结合注册中心使用

我们上次讲到Spring Cloud入门-Zuul服务网关(Hoxton版本)结合注册中心进行使用时,默认情况下Zuul会根据注册中心注册的服务列表,以服务名为路径创建动态路由,Gateway同样也实现了该功能。下面我们演示下Gateway结合注册中心如何使用默认的动态路由和过滤器。

使用动态路由

在pom.xml中添加相关依赖:

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

添加application-eureka.yml配置文件:

server:
  port: 9201
spring:
  application:
    name: api-gateway
  cloud:
    gateway:
      discovery:
        locator:
          #开启从注册中心动态创建路由的功能
          enabled: true 
          #使用小写服务名,默认是大写
          lower-case-service-id: true 
eureka:
  client:
    service-url:
      defaultZone: http://localhost:8001/eureka/
logging:
  level:
    org.springframework.cloud.gateway: debug

使用application-eureka.yml配置文件启动api-gateway服务,访问http://localhost:9201/user-service/user/1,可以路由到user-service的http://localhost:8201/user/1处。

使用过滤器

在结合注册中心使用过滤器的时候,我们需要注意的是uri的协议为lb,这样才能启用Gateway的负载均衡功能。

修改application-eureka.yml文件,使用了PrefixPath过滤器,会为所有GET请求路径添加/user路径并路由;

server:
  port: 9201
spring:
  application:
    name: api-gateway
  cloud:
    gateway:
      routes:
        - id: prefixpath_route
          #此处需要使用lb协议
          uri: lb://user-service 
          predicates:
            - Method=GET
          filters:
            - PrefixPath=/user
      discovery:
        locator:
          enabled: true
eureka:
  client:
    service-url: 
      defaultZone: http://localhost:8001/eureka/
logging:
  level:
    org.springframework.cloud.gateway: debug

使用application-eureka.yml配置文件启动api-gateway服务,访问http://localhost:9201/1 ,可以路由到user-service的http://localhost:8201/user/1处。

使用到的模块

springcloud-learning
├── eureka-server -- eureka注册中心
├── user-service -- 提供User对象CRUD接口的服务
└── api-gateway -- gateway作为网关的测试服务

项目源码地址

GitHub项目源码地址

解决Spring Cloud Gateway中使用OpenFeign出现的错误 问题描述 Spring Cloud版本: Spring Boot 版本: Spring Cloud Gateway 项目中使用了OpenFeign组件,配置引用均正确。报错如下: feign.codec.EncodeException: No qualifying bean of type 'org.springframework.boot.autoconfigure.http.HttpMessageConverters' available: expected at least 1 bean which 阅读详情

相关推荐

Spring Cloud Gateway高级特性之过滤器(Hoxton版本)

1.高级特性—过滤器(Filter) 路由过滤器可用于修改进入的HTTP请求和返回的HTTP响应,路由过滤器只能指定路由进行使用。Spring Cloud Gateway 内置了多种路由过滤器,他们都由GatewayFilter的工厂类来产生,下面将对各个过滤器进行一一说明 Spring Cloud Gateway 内置的过滤器工厂一览表如下: 1.1 AddRequestHeader GatewayFilter 通过配置name和value可以增加请求的header。 spring: cloud

Trazen的专栏 6914

Spring Cloud Gateway:新一代API网关服务

Spring Cloud Gateway 为 SpringBoot 应用提供了API网关支持,具有强大的智能路由与过滤器功能,本文将对其用法进行详细介绍。Gateway ...

macrozheng的专栏 3379

一文看懂英伟达A100、H100、A800、H800、H20

想要Deepseek私有化部署吗?无论是训练大型AI模型,还是进行高性能计算(HPC),还是Deepseek私有化部署,都需要强大的GPU支持。而英伟达(NVIDIA)作为全球领先的AI芯片制造商,推出了一系列高性能GPU,包括等,广泛应用于AI训练、推理、科学计算等领域。如果想搭建一个属于自己的算力中心,该如何选择合适的GPU?本文将带你详细了解这些GPU的特性,并指导你如何搭建算力中心。一、英伟达算力GPU系列解析1. A100:数据中心AI计算的奠基石:Ampere:6912:432。

【可全包】本人程序员,不需要做任何吹嘘,只是实在写点程序,写点文档,熟悉各类主流框架,SSM,SpringBoot,Flask,Djiango,Mysql,Sqlite,VUE,Uniapp等,各类程序设计专家,优质作者 2万+

错误:springcloud gateway hoxton sr3 与springboot版本

开始的时候springboot依赖的父项目是2.2.3版本的,配置网关启动的时候报错spring-webflux 5.2.3发生错误,此时只需要将springboot父项目升级到2.2.5即可

u012781820的博客 1826

如何安装PyFluent

PyFluent 是PyAnsys生态系统的一部分, 允许您在所选的 Python 环境中结合使用 Fluent 与其他 PyAnsys 库和外部 Python 库一起使用。PyFluent 实现了客户端-服务器体系结构。它使用谷歌遥控器 过程调用或 gRPC 接口,用于启动或连接正在运行的 Fluent 进程作为服务器。但是,您只需要与 Python 交互接口。可以使用 PyFluent 以编程方式创建、交互和控制 Fluent 会话,用于创建您自己的自定义工作区。

B_etter_Man的博客 2926

Spring Cloud Gateway (Hoxton版) 使用

文章目录1. 简介2. 基本概念3. 使用3.1 路由断言(Route Predicate)3.1.1 user-service3.1.2 api-gateway3.2 过滤器3.2.1 Hystrix GatewayFilter3.2.2 RequestRateLimiter GatewayFilter3.2.3 Retry GatewayFilter3.2.3.1 api-gateway3.2.3.2 user-service3.3 注册中心3.3.1 eureka-server3.3.1 user-s

shpunishment的博客 890

Python 爬虫:获取网页数据的 5 种方法

requests:适用于简单的静态网页抓取,易于使用。requestslxml:适合需要高效解析大规模网页内容的情况,支持 XPath 和 CSS 选择器。Selenium:适用于动态网页(JavaScript 渲染)的抓取,模拟浏览器行为获取动态数据。Scrapy:强大的爬虫框架,适合大规模的网页抓取任务,支持异步请求和高级功能。PyQuery:基于 jQuery 语法,适合快速开发,提供简洁的 CSS 选择器语法。

想看什么文章都可以私信给我,综合性博客。 5515

SpringCloud组件之网关Spring Cloud Gateway(Hoxton版本)

目录 1.Spring Cloud Gateway简介 1.1 相关特性 1.2 相关概念 2.创建Spring Cloud Gateway工程 2.1在pom中添加相关依赖 2.2 spring cloud gateway路由配置有两种方法 2.2.1配置文件方式 2.2.2 JAVA BEAN配置如下 2.3启动程序,进行路由测试 3.项目git地址 4.参考 1.Spring Cloud Gateway简介 Spring Cloud Gateway 为 SpringBoot 应用提供了API网关支持

m0_54850467的博客 1192

搜索引擎——ElasticSearch汇总

汇总——ElasticSearch篇 全文检索 问题1:什么是全文检索? 基本概念:对**非结构化数据/结构化数据**先建立**索引**,再对索引进行搜索**文档**的过程叫做全文检索。 什么是非结构化与结构化数据? - 非结构化数据:没有固定的格式的数据(html,word,excel)---没有固定长度,字段约束,描述,散列数据 - 结构化数据:有固定的格式的数据(如:数据库数据)---有固定长度(varchar(50)),字段类型,描述修饰数据 搜索算法:顺序扫描法、倒排索引法 - 顺序

alonewolf_99的博客 1840

YOLOv11改进策略【损失函数篇】| 通过辅助边界框计算IoU提升检测效果(Inner_GIoU、Inner_DIoU、Inner_CIoU、Inner_EIoU、Inner_SIoU)

为了弥补现有 IoU 损失在不同检测任务中泛化性弱和收敛速度慢的问题,·Inner-IoU·通过引入比例因子 “ratio” 来控制辅助边界框的尺度大小,利用不同尺度的辅助边界框来计算损失,从而加速边界框回归过程。

Limiiiing的博客 3892

一个可供小团队参考的微服务落地实践

因为微服务是对整个团队的考验,从开发到交付,每一步都充满了挑战。经过 1 年多的探索和实践,本着将 DevOps 落实到产品中的愿景,一步步建设出适合我们的微服务平台。 要不要微服务 我们的产品是 Linkflow,企业运营人员使用的客户数据平台(CDP)。产品的一个重要部分类似企业版的“捷径",让运营人员可以像搭乐高积木一样创建企业的自动化流程,无需编程即可让数据流动起来。 ...

weixin_34095889的博客 1143

Vue3 + 高德地图实现车辆电子围栏监控与报警

通过本文的实现,我们完成了一个通用的车辆电子围栏监控功能:支持多种围栏类型。支持进入/离开/双向报警。使用缓存机制避免重复告警。可与Vue3 + 高德地图无缝集成。在实际项目中,可以结合WebSocket 实时定位,实现车辆的实时监控 + 围栏告警系统🚀。

专注于前端开发与实战技巧,记录从零到一的学习与项目经验。分享 Vue3 / JavaScript / TypeScript / Flutter /Uniapp等前端技术,以及 性能优化、工程化、最佳实践。 1035

Spring Cloud入门-Gateway服务网关(Hoxton版本),java反射机制面试题

为什么我不完全主张自学?①平台上的大牛基本上都有很多年的工作经验了,你有没有想过之前行业的门槛是什么样的,现在行业门槛是什么样的?以前企业对于程序员能力要求没有这么高,甚至十多年前你只要会写个“Hello World”,你都可以入门这个行业,所以以前要入门是完全可以入门的。②现在也有一些优秀的年轻大牛,他们或许也是自学成才,但是他们一定是具备优秀的学习能力,优秀的自我管理能力(时间管理,静心坚持等方面)以及善于发现问题并总结问题。

ccc6553584的博客 1112

【RT-DETR涨点改进】独家Conv改进篇 | 来自TIP 2024顶刊| 引入 DEConv细节增强卷积模块, 能够恢复更多细节信息,提升小目标检测精度、含多种不同模型改进点

本文提出了一种细节增强卷积(DEConv)模块,通过融合多种差异卷积(CDC、ADC、HDC、VDC)来增强图像特征表示能力,特别在边缘和纹理细节提取方面表现突出。该模块采用重参数化技术,在不增加计算成本的情况下,将先验信息融入常规卷积层,显著提升了RT-DETR模型在模糊或遮挡场景下的目标检测精度。实验验证了DEConv在多种骨干网络(ResNet18/50、HGNet等)中的有效性,为实时目标检测系统提供了轻量高效的改进方案。

Ai缝合怪、助力小伙伴高效发论文 452

IDEA的使用指南

IDEA基于java的使用手册,可以最快速的上手,在使用中不断的丰富自己的使用技巧.

Spring Cloud入门-汇总篇(Hoxton版本)

文章目录简介应用场景注册中心配置中心服务网关服务调用熔断与限流安全保护监控中心分布式事务解决目录项目结构项目地址 项目使用的Spring Cloud为Hoxton版本,Spring Boot为2.2.2.RELEASE版本 简介 Spring Cloud是一系列框架的有序集合。目的是协调各个微服务,简化分布式系统开发。这里做一个有关于Spring Cloud知识的汇总,包括Spring Clo...

ThinkWon的博客 3万+

lwip-2.0.3

lwip是瑞典计算机科学院(SICS)的Adam Dunkels 开发的一个小型开源的TCP/IP协议栈。实现的重点是在保持TCP协议主要功能的基础上减少对RAM 的占用。

SpringCloud Hoxton——Gateway服务网关

SpringCloud Hoxton——Gateway服务网关

贝尔摩德苦艾酒 7100

C# WinForm 基于DirectShow.dll编写的程序,可边预览边保存视频,音频和图片

基于微软的DirectShow.dll的二次开发1.自动识别连接的摄像头跟麦克风且可以对其进行选择(默认选中第一个)2.可录制wmv和avi两种格式的视频并且都带有音频,avi可以录制的分辨率和帧数进行选择,wmv默认进行了淸晰度优化如不喜欢可去除代码中有相关提示3.可在预览点开之后进行拍照,也可边录制视频边拍照4.添加了视频和音频的压缩功能(酌情使用)这次二次开发发现C#对DirectShow的相关信息太少,这次做完也不敢藏私共享出来,还望大家指正

jdk-8u144-linux-x64.tar.gz.

该资源为搭建Linux系统Java环境用,资源的后缀为tar.gz格式的压缩包

spring cloud gateway 打印日志

打印简单日志 @Slf4j @Component public class AccessLogGlobalFilter implements GlobalFilter { @Override public Mono<Void> filter(ServerWebExchange exchange, GatewayFilterChain chain) { ServerHttpRequest request = exchange.getRequest();

爱码士的博客 6889

Spring Cloud Hoxton.RELEASE 正式发布!异步即未来

Spring社区宣布,Spring Cloud Hoxton RELEAS 正式发布。该版本可以在Maven Central中找到。您可以查看Hoxton 发行说明以获取更多信息。 <dependencyManagement> <dependencies> <dependency> <groupId>o...

冷冷的博客 7246

spring cloud gateway中读取请求参数

1. 我的版本: spring-cloud:Hoxton.RELEASE spring-boot:2.2.2.RELEASE spring-cloud-starter-gateway 2. 请求日志 import lombok.extern.slf4j.Slf4j; import org.springframework.cloud.gateway.filter.G...

影落离风 5827
上一篇: Spring Cloud入门-Consul服务注册发现与配置中心(Hoxton版本)
下一篇: Spring Cloud入门-Admin服务监控中心(Hoxton版本)
RyanJohnson
RyanJohnson 优质创作者: Java技术领域 优质创作者: Java技术领域 领域专家: 后端开发技术领域 领域专家: 后端开发技术领域
博客等级 码龄9年 30万+粉丝 285原创
评论 5
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值