5

When I upgrade implementation 'org.springframework.cloud:spring-cloud-openfeign-core:2.2.2.RELEASE' to latest version implementation 'org.springframework.cloud:spring-cloud-openfeign-core:3.1.1'

I get error for this imported class:

import org.springframework.cloud.openfeign.ribbon.CachingSpringLoadBalancerFactory
import org.springframework.cloud.openfeign.ribbon.LoadBalancerFeignClient;

@Bean
  public Client client(
      HttpClientConnectionManager httpClientConnectionManager,
      CachingSpringLoadBalancerFactory lbClientFactory,
      SpringClientFactory clientFactory) {

    CloseableHttpClient closeableHttpClient = HttpClients.custom()
        .setConnectionManager(httpClientConnectionManager)
        .build();
    ApacheHttpClient delegate = new ApacheHttpClient(closeableHttpClient);
    return new LoadBalancerFeignClient(delegate, lbClientFactory, clientFactory);
  }

Do you know how I have to replace them in order to use the latest version?

Peter Penzov
  • 1,126
  • 134
  • 430
  • 808
  • The same problem was reported here: https://stackoverflow.com/questions/65884281/migrate-feign-load-balancer-implementation-to-compatible-with-spring-cloud-2020. Check if it fixes. – pringi Mar 31 '22 at 11:04
  • I check it but it's not solving the issue. – Peter Penzov Apr 02 '22 at 00:47

1 Answers1

1

ribbon was excluded from that spring boot version, you should now use loadbalancer instead. Check this class org.springframework.cloud.openfeign.loadbalancer.FeignLoadBalancerAutoConfiguration, from my POV, you just need to remove all your ribbon dependencies from the code and that's it.

red
  • 606
  • 10
  • 17