项目之前利用的时候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会报一个错误
- [ctor-http-nio-5] reactor.netty.http.server.HttpServer : [49b02120-1, L:/0:0:0:0:0:0:0:1:10215 - R:/0:0:0:0:0:0:0:1:57712]
- java.lang.NoSuchMethodError: reactor.netty.http.server.HttpServerRequest.hostPort()I
- at org.springframework.http.server.reactive.ReactorServerHttpRequest.resolveBaseUrl(ReactorServerHttpRequest.java:84) ~[spring-web-5.3.33.jar:5.3.33]
- at org.springframework.http.server.reactive.ReactorServerHttpRequest.initUri(ReactorServerHttpRequest.java:79) ~[spring-web-5.3.33.jar:5.3.33]
- at org.springframework.http.server.reactive.ReactorServerHttpRequest.<init>(ReactorServerHttpRequest.java:71) ~[spring-web-5.3.33.jar:5.3.33]
- at org.springframework.http.server.reactive.ReactorHttpHandlerAdapter.apply(ReactorHttpHandlerAdapter.java:58) ~[spring-web-5.3.33.jar:5.3.33]
- at org.springframework.http.server.reactive.ReactorHttpHandlerAdapter.apply(ReactorHttpHandlerAdapter.java:40) ~[spring-web-5.3.33.jar:5.3.33]
- at reactor.netty.http.server.HttpServer$HttpServerHandle.onStateChange(HttpServer.java:985) ~[reactor-netty-http-1.0.24.jar:1.0.24]
- at reactor.netty.ReactorNetty$CompositeConnectionObserver.onStateChange(ReactorNetty.java:677) [reactor-netty-core-1.0.24.jar:1.0.24]
复制代码 终极解决办法
升级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企服之家,中国第一个企服评测及商务社交产业平台。 |