使用 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包里面模块的引用,冲突再去掉