Skip to content
Advertisement

Spring boot and Zuul proxy DeferringLoadBalancerExchangeFilterFunction Error

I have a simple app that uses Netflix Zuul as an API gateway

I added the Zuul dependency in the pom.xml file as follows:

<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-starter-netflix-zuul</artifactId>
    <version>2.2.10.RELEASE</version>
</dependency>

and @EnableZuulProxy for the main class of the app

The problem is that whenever I try to run the API, It fails to start and shows in the console:

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

I couldn’t solve the issue, what’s the problem?

Advertisement

Answer

The issue was solved when I added the following dependency in pom.xml:

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

and as a result, spring also asked me to add this to my app configuration:

spring.main.web-application-type=reactive

Then my API ran successfully without failing or throwing any exception

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement