Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spring Cloud Gateway 2022已经使用reactor-core 3.x,WebFlux框架高度依赖Reactor,**建议保持和 Gateway Reactor版本同步** #622

Open
aaric opened this issue May 15, 2024 · 2 comments

Comments

@aaric
Copy link

aaric commented May 15, 2024

使用版本:

latest
(io.projectreactor:reactor-core:3.1.4.RELEASE 发布年份2018-02-15)

报错信息:

ClassNotFoundException: reactor.util.context.ContextView

希望结果:

Spring Cloud Gateway不被影响

复现步骤:

1.正常搭建网关,引入依赖

ext {
    // https://github.com/alibaba/spring-cloud-alibaba/wiki/版本说明#毕业版本依赖关系推荐使用
    springCloudVersion = "2022.0.0"
    springCloudAlibabaVersion = "2022.0.0.0"
    knife4jVersion = "4.5.0"
    saTokenVersion = "1.37.0"
}

dependencyManagement {
    imports {
        mavenBom "org.springframework.cloud:spring-cloud-dependencies:$springCloudVersion"
        mavenBom "com.alibaba.cloud:spring-cloud-alibaba-dependencies:$springCloudAlibabaVersion"
        mavenBom "com.github.xiaoymin:knife4j-dependencies:$knife4jVersion"
        mavenBom "cn.dev33:sa-token-dependencies:$saTokenVersion"
     }
}

dependencies {
    implementation project(":v2x-common")

    implementation "com.github.xiaoymin:knife4j-gateway-spring-boot-starter"

    // Fixed: ClassNotFoundException: reactor.util.context.ContextView
    //implementation "io.projectreactor:reactor-core:3.5.4"

    implementation "org.springframework.cloud:spring-cloud-starter-gateway"
    implementation "org.springframework.cloud:spring-cloud-starter-loadbalancer"
    implementation "org.springframework.cloud:spring-cloud-starter-bootstrap"
    implementation "com.alibaba.cloud:spring-cloud-starter-alibaba-nacos-discovery"
    implementation "com.alibaba.cloud:spring-cloud-starter-alibaba-nacos-config"

    implementation "org.springframework.boot:spring-boot-starter-log4j2"
}

2.网关启动报错

ClassNotFoundException: reactor.util.context.ContextView

3.原因分析
最新的cn.dev33:sa-token-dependencies:1.38.0使用的reactor-core版本还是<reactor-core.version>3.1.4.RELEASE</reactor-core.version>,Spring Cloud Gateway 2022已经使用reactor-core 3.x,WebFlux框架高度依赖Reactor,建议保持和 Gateway Reactor版本同步

< 备注:如果复现步骤比较复杂,请将 demo 上传到 gitee 并留下地址 >

@aaric
Copy link
Author

aaric commented May 15, 2024

Snipaste_2024-05-15_15-32-51

@aaric
Copy link
Author

aaric commented May 15, 2024

Snipaste_2024-05-15_15-34-03

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant