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

用workbuddy自定义Skill:手把手搭建AI炒股分析助手

AI Agent正成为个人投资研究的重要工具,而Skill作为行为规范,能让AI输出保持稳定与专业。在AI Agent应用中,很多人分不清Skill与Agent的区别:Agent负责目标拆解与执行,Skill则固化分析流程与输出模板。借助本地工作台workbuddy,用户可自定义Skill,实现从市场环境检查到财务排雷的五段式分析。通过调低温度参数、设定数据验证规则,该方案能有效避免大模型凭空编造数据,帮助个人投资者快速完成基本面体检、资金面观察与风险清单生成。本文基于一套可直接套用的配置与一个月实测,展示

weixin_29038537的博客 535

错误:springcloud gateway hoxton sr3 与springboot版本

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

u012781820的博客 1826

HID报告描述符实战解析:从Usage到Item的完整设计流程

本文深入解析了HID报告描述符的设计流程,从核心概念Usage(用途定义)入手,详细阐述了如何通过Item(条目)的三种角色——全局、局部与主干,构建出能被系统正确识别的设备“说明书”。文章以标准USB鼠标和键盘为例进行实战拆解,并介绍了使用Report ID与自定义设备等进阶设计方法,帮助开发者掌握这一实现USB设备即插即用的关键技术。

weixin_29230865的博客 282

vscode远程连接deepin出错:过程试图写入的管道不存在的解决方法

背景:昨天我用vscode使用ssh远程开发还处于正常状态,今天刚打开电脑,并启动deepin,再次使用vscode重新连接就出现异常。意思就是22号默认端口连接被拒绝,所以要先确定ssh是否连接。3.重新进入vscode里面,重新连接,如图成功连接。,查看port后面的端口号是不是22号。1.检查sshd是否启动。

qq_43573047的博客 2946

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

从仿真到实物:Realsense D435+ROS2焊接机械臂的视觉标定与数据验证指南

本文详细介绍了如何将Realsense D435相机与ROS2焊接机械臂从仿真环境迁移到实物部署的全过程。通过视觉标定、数据验证和焊接场景优化,确保系统在真实环境中精准可靠。重点讲解了硬件配置、驱动优化、数据一致性验证及焊接应用的特殊处理,为工业自动化开发者提供实用指南。

weixin_28701593的博客 407

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

Arduino MLX90393磁力计驱动库:高精度三轴霍尔传感器开发指南

三轴霍尔效应磁力计是嵌入式系统中实现无接触角度检测、电子罗盘与电流传感的核心器件。其工作原理基于霍尔电压随外磁场矢量变化的物理特性,通过I²C接口输出高分辨率(16/20-bit)XYZ轴原始数据,并集成温度补偿与数字滤波功能。技术价值体现在确定性响应、低功耗(典型0.5 μA待机)及强抗干扰能力,适用于电池供电设备与实时操作系统环境。典型应用场景包括电机位置反馈、永磁体旋转角度解算、工业编码器和地磁导航。本库专为Arduino生态优化,深度封装MLX90393寄存器协议与自校准流程,同时兼容STM32、E

weixin_29363791的博客 642

用MCP扩展Cursor的5种神奇用法:从文件操作到网页抓取实战

本文深入探讨了如何利用MCP(Model Context Protocol)扩展Cursor AI编程助手,解锁五种高效实用场景。从文件系统操作、网页内容抓取,到数据库查询、Figma设计稿对接,乃至构建自定义MCP服务器,文章通过实战案例展示了如何将Cursor从代码编辑器升级为能理解并操作工作环境的智能助手,显著提升开发效率与自动化水平。

weixin_29231027的博客 316

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

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

weixin_34095889的博客 1143

2 君正底层API接口的封装1

君正的IPC芯片主要有T31、T40、T41等型号,每个型号的API接口大部分是相同的,但也存在一些不一致和差异化的地方。为了屏蔽不同芯片型号之间的差异,我们需要基于一个公共基类进行封装。在封装之前,我们需要定义自己的错误码和数据结构,用于屏蔽不同君正芯片的实现细节。为了确保整个IPC库使用统一的错误码,我们在HP_MPPErrorCode.h文件中专门定义了以下错误码。错误码囊括了参数错误、内存错误、溢出错误、不支持、密码错误、非法数据等各种异常情况。

hope_wisdom的技术博客 1588

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

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

ccc6553584的博客 1112

最强AI插件Augment,适配idea、vscode,对标cursor!

Augment是一款新兴的AI辅助编码工具,能够无缝集成到IDEA和VS Code等主流IDE中,直接对标专业AI编码工具Cursor。其核心优势包括多IDE适配、无缝集成、代码理解与生成以及对话式编程体验。Augment通过插件形式保留原IDE功能和快捷键习惯,降低学习成本,同时提供深度理解项目上下文和生成高质量代码的能力。此外,Augment还具备审查变更、检查点、代理与代理自动等核心功能,支持从简单配置更改到复杂功能实现的各种开发任务。Augment代表了AI辅助编程工具的新方向,通过增强开发者熟悉的

todoitbo的博客 1万+

最新的sdio 4.0 spec 协议标准 带书签 高清完整PDF版

Part-E1-SDIO-Specification-Ver4.00-Final-120220.pdf:最新的sdio 4.0 spec 协议标准 带书签 高清完整PDF版,包括SDIO 接口的外设,SDIO 接口官方协议等。

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

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

ThinkWon的博客 3万+

LinePhone3.2.7(android端最新版本) sip客户端

SIP客户端For android:LinePhone3.2.7(最新版本),官网地址:http://www.linphone.org/

SpringCloud Hoxton——Gateway服务网关

SpringCloud Hoxton——Gateway服务网关

贝尔摩德苦艾酒 7100

文档:亲测可用解决vnc灰屏,黑屏,鼠标大黑叉情况

主要解决vnc-viewer灰屏,黑屏,鼠标大黑叉等现象,详细见文档。

ET2012新版免狗免安装绿色软件

ET2012新版免狗免安祖昂绿色软件。,新界面,新视觉,

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、付费专栏及课程。

余额充值