org.springframework.cloud.client.loadbalancer.reactive.DeferringLoadBalancerExchangeFilterFunction

在SpringBoot项目中遇到启动报错,提示缺少DeferringLoadBalancerExchangeFilterFunction的bean。添加spring-cloud-starter-loadbalancer依赖后,发现是由于某个引入的jar包(fls-log-collector)内隐含了spring-cloud-starter-gateway导致的冲突。通过排除gateway模块并移除多余依赖,问题得到解决。检查和管理依赖关系是解决此类问题的关键。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

使用 spring-boot-starter-web 项目,启动的时候,突然报错了:

Parameter 0 of method loadBalancerWebClientBuilderBeanPostProcessor in 
org.springframework.cloud.client.loadbalancer.reactive.
LoadBalancerBeanPostProcessorAutoConfiguration required a bean of type 
'org.springframework.cloud.client.loadbalancer.reactive.
DeferringLoadBalancerExchangeFilterFunction' that could not be found.


Action:

Consider defining a bean of type 'org.springframework.cloud.client.loadbalancer.
reactive.DeferringLoadBalancerExchangeFilterFunction' in your configuration.

提示没有对应依赖,就先加:

gradle:

implementation 'org.springframework.cloud:spring-cloud-starter-loadbalancer'

再启动,又报另外一个错:

Consider defining a bean of type 'org.springframework.cloud.client.loadbalancer.reactive.
DeferringLoadBalancerExchangeFilterFunction' in your configuration.

再查了下,里面说是 gateway影响了。搜了下,项目并没有引用gateway的内容。

然后点击help -->  dependencies 查看

搜索gateway

 

 真的有。 没想到是引入一个包的时候,引入的。

去掉 该jar包引用的模块:

implementation ('com.fls:fls-log-collector:1.0.0-SNAPSHOT'){
        exclude module: "spring-cloud-starter-gateway"
    }

再去掉上面加的引用。 再启动就正常。 

总结:

        遇到引用包有冲突的时候,用 help -->  dependencies 查看相关jar包里面模块的引用,冲突再去掉

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

天狼1222

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值