springboot集成springCloud中g(shù)ateway時(shí)啟動(dòng)報(bào)錯(cuò)的解決
在項(xiàng)目中引入springcloud中的gateway時(shí)報(bào)以下錯(cuò)誤
Description:
Parameter 0 of method modifyRequestBodyGatewayFilterFactory in org.springframework.cloud.gateway.config.GatewayAutoConfiguration
required a bean of type 'org.springframework.http.codec.ServerCodecConfigurer' that could not be found.Action:
Consider defining a bean of type 'org.springframework.http.codec.ServerCodecConfigurer' in your configuration.
這個(gè)是由于依賴沖突,spring-cloud-starter-gateway與spring-boot-starter-web和spring-boot-starter-webflux依賴沖突
解決方式:
在引入gateway時(shí)過濾掉上面兩個(gè)依賴
<dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-gateway</artifactId> <exclusions> <exclusion> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </exclusion> <exclusion> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-webflux</artifactId> </exclusion> </exclusions> </dependency>
springboot整合gateway啟動(dòng)失敗
問題:
springboot整合gateway啟動(dòng)失敗
***************************
APPLICATION FAILED TO START
***************************
Description:
An attempt was made to call a method that does not exist. The attempt was made from the following location:
org.springframework.cloud.gateway.config.GatewayAutoConfiguration$NettyConfiguration.gatewayHttpClient(GatewayAutoConfiguration.java:622)
The following method did not exist:
reactor.netty.resources.ConnectionProvider.elastic(Ljava/lang/String;Ljava/time/Duration;Ljava/time/Duration;)Lreactor/netty/resources/ConnectionProvider;
The method's class, reactor.netty.resources.ConnectionProvider, is available from the following locations:
jar:file:/C:/Users/Administrator/.m2/repository/io/projectreactor/netty/reactor-netty/0.9.1.RELEASE/reactor-netty-0.9.1.RELEASE.jar!/reactor/netty/resources/ConnectionProvider.class
It was loaded from the following location:
file:/C:/Users/Administrator/.m2/repository/io/projectreactor/netty/reactor-netty/0.9.1.RELEASE/reactor-netty-0.9.1.RELEASE.jar
Action:
Correct the classpath of your application so that it contains a single, compatible version of reactor.netty.resources.ConnectionProvider
Disconnected from the target VM, address: '127.0.0.1:55875', transport: 'socket'
Process finished with exit code 1
這塊主要是版本兼容的問題,
最初用的版本是:
<dependency> <groupId>io.projectreactor.netty</groupId> <artifactId>reactor-netty</artifactId> <version>0.9.4.RELEASE</version> </dependency>
網(wǎng)上有的是需要把這個(gè)版本降低,我這是降低了也不行
最后升高了版本改成了:
<dependency> <groupId>io.projectreactor.netty</groupId> <artifactId>reactor-netty</artifactId> <version>0.9.14.RELEASE</version> </dependency>
本項(xiàng)目里springboot版本為:2.3.1,根據(jù)自己項(xiàng)目需要吧,看一下自己項(xiàng)目中各個(gè)版本之間的問題
以上為個(gè)人經(jīng)驗(yàn),希望能給大家一個(gè)參考,也希望大家多多支持腳本之家。
- Spring Cloud 配置中心多環(huán)境配置bootstrap.yml的實(shí)現(xiàn)方法
- 解決springboot與springcloud版本兼容問題(附版本兼容表)
- 將Springboot項(xiàng)目升級(jí)成Springcloud項(xiàng)目的圖文教程
- SpringCloud解決Feign異步回調(diào)問題(SpringBoot+Async+Future實(shí)現(xiàn))
- SpringBoot項(xiàng)目改為SpringCloud項(xiàng)目使用nacos作為注冊中心的方法
- SpringBoot(cloud)自動(dòng)裝配bean找不到類型的問題
- 解決nacos升級(jí)spring cloud 2020.0無法使用bootstrap.yml的問題
- 從零開始搭建springboot+springcloud+mybatis本地項(xiàng)目全過程(圖解)
- 詳解SpringBoot與SpringCloud的版本對應(yīng)詳細(xì)版
- Spring、Spring?Boot、Spring?Cloud?的區(qū)別與聯(lián)系分析
相關(guān)文章
Maven 搭建SpringMVC+Hibernate項(xiàng)目詳解
本文主要介紹Maven 搭建SpringMVC+Hibernate的知識(shí),這里整理了詳細(xì)的資料,并附示例代碼,有興趣的小伙伴可以參考下2016-09-09IntelliJ?IDEA?2022.2?正式發(fā)布新功能體驗(yàn)
IntelliJ?IDEA?2022.2為遠(yuǎn)程開發(fā)功能帶來了多項(xiàng)質(zhì)量改進(jìn),使其更美觀、更穩(wěn)定,新版本還具有多項(xiàng)值得注意的升級(jí)和改進(jìn),下面跟隨小編一起看看IDEA?2022.2新版本吧2022-08-08Java文件下載ZIP報(bào)錯(cuò):Out of Memory的問題排查
本文主要介紹了Java項(xiàng)目中下載大文件(超過2G的ZIP文件)時(shí)出現(xiàn)內(nèi)存溢出(OutOfMemory:JavaHeapSpace)的問題,具有一定的參考價(jià)值,感興趣的可以了解一下2025-01-01Spring思維導(dǎo)圖助你輕松學(xué)習(xí)Spring
這篇文章主要為大家詳細(xì)介紹了Spring思維導(dǎo)圖,幫助你輕松學(xué)習(xí)Spring的相關(guān)資料,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2018-03-03Spring Boot 多個(gè)定時(shí)器沖突問題的解決方法
這篇文章主要介紹了Spring Boot 多個(gè)定時(shí)器沖突問題的解決方法,實(shí)際開發(fā)中定時(shí)器需要解決多個(gè)定時(shí)器同時(shí)并發(fā)的問題,也要解決定時(shí)器之間的沖突問題,本文通過問題場景重現(xiàn)給大家介紹的非常詳細(xì),需要的朋友參考下吧2022-05-05springboot?vue測試平臺(tái)開發(fā)調(diào)通前后端環(huán)境實(shí)現(xiàn)登錄
這篇文章主要介紹了springboot?vue測試平臺(tái)開發(fā)調(diào)通前后端環(huán)境實(shí)現(xiàn)登錄詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪2022-05-05Spring組件初始化擴(kuò)展點(diǎn)BeanPostProcessor的作用詳解
本文通過實(shí)戰(zhàn)案例和常見應(yīng)用場景詳細(xì)介紹了BeanPostProcessor的使用,并強(qiáng)調(diào)了其在Spring擴(kuò)展中的重要性,感興趣的朋友一起看看吧2025-03-03Java設(shè)計(jì)模式七大原則之里氏替換原則詳解
在面向?qū)ο蟮某绦蛟O(shè)計(jì)中,里氏替換原則(Liskov Substitution principle)是對子類型的特別定義。本文將為大家詳細(xì)介紹Java設(shè)計(jì)模式七大原則之一的里氏替換原則,需要的可以參考一下2022-02-02