一、背景描述

启动一个springboot项目时,竟然发现项目启动失败,提示信息如下:
Description:

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.

14:20:01.605 WARN c.a.n.c.http.HttpClientBeanHolder [108] - [HttpClientBeanHolder] Start destroying common HttpClient

Process finished with exit code 1

二、问题原因

原因:springboot版本问题2.4以上有此问题

三、解决方案

添加负载均衡

    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-starter-loadbalancer</artifactId>
    </dependency>

更多推荐

Consider defining a bean of type ‘org.springframework.cloud.client.loadbalancer.