I use OpenFeign in Spring but it startup failed, and the log prompts

"No Feign Client for loadBalancing defined. Did you forget to include spring-cloud-starter-loadbalancer?"

So I import the spring-cloud-starter-loadbalancer

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

But the log shows a warning

"2022-08-31 16:50:16.843 WARN 32576 --- [ main] iguration$LoadBalancerCaffeineWarnLogger : Spring Cloud LoadBalancer is currently working with the default cache. While this cache implementation is useful for development and tests, it's recommended to use Caffeine cache in production.You can switch to using Caffeine cache, by adding it and org.springframework.cache.caffeine.CaffeineCacheManager to the classpath."

So I import the caffeine, while the caffeine version is 2.x, the warning disappeared without any configuration.

<dependency>
    <groupId>com.github.ben-manes.caffeine</groupId>
    <artifactId>caffeine</artifactId>
    <version>${caffeine.version}</version>
</dependency>

But when the caffeine version is 3.x, this warning still exists after import caffeine, I have tried the following two configuration in application.yml, but the warning still exists. Is it need others configuration or not support caffeine3?

spring:
  cloud:
    loadbalancer:
      cache:
        caffeine:
          spec: initialCapacity=50,maximumSize=500,expireAfterWrite=5s,refreshAfterWrite=7s
spring:
  cache:
    caffeine:
      spec: initialCapacity=50,maximumSize=500,expireAfterWrite=5s,refreshAfterWrite=7s

Comment From: OlgaMaciaszek

Hello, @aofall , you should not define the versions for either Caffeine, OpenFeign or LoadBalancer in your pom. They should be provided by the Spring Cloud and Spring Boot bom. You can use start.spring.io site to generate a correct pom with Spring Cloud and Spring Boot dependency management.

Comment From: aofall

Thank for reply, already used the Spring Cloud and Spring Boot bom in my project pom, I just want to upgrade the Caffeine to the latest version.

Comment From: OlgaMaciaszek

@aofall Unfortunately, that might result in lack of compatibility. However, Spring Boot 3 will support Caffeine 3, so you'll be able to make this switch once it's been released.