自由的羽毛 发表于 2024-7-24 20:56:40

springCloud升级springweb的问题

项目之前利用的时候springgboot-2.6.13,gateway-3.1.4。然后安全检查的时候说
软件:spring-web(jar) 5.3.23
掷中:["spring-web(jar) version less than 5.3.32"]
路径:/opt/gateway-0.0.1-SNAPSHOT.jar(BOOT-INF/lib/spring-web-5.3.23.jar)
解决办法就是要升级spring-web的版本
因为springboot-2.6.13已经不再维护了,直接从gateway的依靠里面去掉spring-web,然后重新引入spring-web-5.3.33会报一个错误
reactor.netty.http.server.HttpServer   :

java.lang.NoSuchMethodError: reactor.netty.http.server.HttpServerRequest.hostPort()I
        at org.springframework.http.server.reactive.ReactorServerHttpRequest.resolveBaseUrl(ReactorServerHttpRequest.java:84) ~
        at org.springframework.http.server.reactive.ReactorServerHttpRequest.initUri(ReactorServerHttpRequest.java:79) ~
        at org.springframework.http.server.reactive.ReactorServerHttpRequest.<init>(ReactorServerHttpRequest.java:71) ~
        at org.springframework.http.server.reactive.ReactorHttpHandlerAdapter.apply(ReactorHttpHandlerAdapter.java:58) ~
        at org.springframework.http.server.reactive.ReactorHttpHandlerAdapter.apply(ReactorHttpHandlerAdapter.java:40) ~
        at reactor.netty.http.server.HttpServer$HttpServerHandle.onStateChange(HttpServer.java:985) ~
        at reactor.netty.ReactorNetty$CompositeConnectionObserver.onStateChange(ReactorNetty.java:677) 终极解决办法
升级springboot的版本到2.7.11
dependencyManagement {
    imports {
      mavenBom "org.springframework.boot:spring-boot-dependencies:2.7.11" // 使用最新的2.7.x版本
      mavenBom "org.springframework.cloud:spring-cloud-dependencies:2021.0.7" // 使用最新的2021.0.x版本
    }
} implementation(group: 'org.springframework.cloud', name: 'spring-cloud-starter-gateway', version: '3.1.4'){
      exclude group: 'org.springframework', module: 'spring-web'
    }
    implementation group: 'org.springframework', name: 'spring-web', version: '5.3.34'
    implementation 'io.projectreactor.netty:reactor-netty:1.0.25'

免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。
页: [1]
查看完整版本: springCloud升级springweb的问题