小编bkk*_*bkk的帖子

Spring Cloud Gateway 与 Redis 会话管理的工作示例?

您能否指出spring-cloud-starter-gateway工作示例的任何书面或视频教程?使用spring-session-data-redisSpring Boot 2和可能相关的库,例如 spring security?

基本上,我想在微服务环境中使用 Spring Clouting Gateway 服务器。我也想使用 Spring Boot 2.X。整个系统基于反应式原理。

我找到了很多如何使用 Redis 速率限制器设置spring-cloud-starter-gateway服务器的示例。我有一个网关服务器的工作版本,但它没有使用基于 Redis 的会话管理。当我将 Redis for session 放入图片中时,我会遇到各种异常。因此,非常感谢任何工作示例。

redis spring-boot spring-cloud-gateway

8
推荐指数
1
解决办法
834
查看次数

Spring Cloud Gateway总是返回HTTP状态503,如何解决?

我正在尝试将 Spring Cloud Gateway 与 Spring Security 结合使用。但不幸的是,看起来安全性并不重要,所有请求都经过其目的地,或者至少尝试经过。只是尝试一下,因为我每次都会收到 HTTP 状态 503。我在 Spring 5,并尝试尽可能地“反应”。我究竟做错了什么?当服务尝试使用功能区负载平衡查找目的地时,日志中没有任何有趣的内容,只有常见的行。我还启用了网关服务器上的访问日志,希望能得到一些额外的信息,但什么也没有。

我已经简化了我的代码,这是不起作用的最小配置。

POM依赖和依赖管理:

    <dependencies>
        <!-- Spring Cloud Gateway service -->
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-gateway</artifactId>
        </dependency>

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

        <!-- Spring Cloud config client -->
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-config-client</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-webflux</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-starter-logging</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <!-- Spring Security -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-security</artifactId>
        </dependency>
    </dependencies>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-dependencies</artifactId>
                <version>${spring-cloud.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>
Run Code Online (Sandbox Code Playgroud)

bootstrap.yml:

spring:
  application:
    name: …
Run Code Online (Sandbox Code Playgroud)

spring-boot spring-cloud spring-cloud-gateway

5
推荐指数
0
解决办法
2351
查看次数