gpt4 book ai didi

java - 在 oauth2 中使用 spring cloud gateway

转载 作者:塔克拉玛干 更新时间:2023-11-03 03:26:23 24 4
gpt4 key购买 nike

i face a problem when i using spring cloud gateway

is if any dependency call spring-boot-starter-tomcat directly or recursively

it will not work because it will start the embedded tomcat server not the netty server that spring cloud gateway use

我开始通过排除这个依赖来解决这个问题

        <exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</exclusion>
</exclusions>

the spring cloud gateway worked successfully

but sometimes i want to use spring-cloud-starter-oauth2 to use @EnableOAuth2Sso

我开始使用

    <dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-oauth2</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</exclusion>
</exclusions>
</dependency>

at that time i face the big issue that throw exception saying

Caused by: java.lang.IllegalStateException: Failed to introspect annotated methods on class org.springframework.security.oauth2.config.annotation.web.configuration.OAuth2ClientConfiguration ......

Caused by: java.lang.NoClassDefFoundError: javax/servlet/Filter

最佳答案

如您所见,Spring 云网关使用 react 模型,并且基于 netty 而不是 tomcat。响应式(Reactive)更改是一个重大转变,目前不受 Spring Security 支持,但相关工作正在进行中,您可以在 https://github.com/spring-cloud/spring-cloud-gateway/issues/179 跟踪它。

关于java - 在 oauth2 中使用 spring cloud gateway,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49795385/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com