Spring Cloud LoadBalancer is currently working with the default cache. You can switch to using Caffeine cache, by adding it to the classpath

1/21/2021

Small question regarding a warning.

I have a Spring Boot 2.4.2 + Spring Cloud app deployed in Kubernetes. It it behaving well, very happy about it.

As the app is calling up to a large number in Kubernetes, I just decided to bring in the spring-cloud-starter-kubernetes-fabric8 dependency.

And really, the discovery part is really all that matter. Config via Config Map and Secrets are not needed, handled by Spring Cloud Config, so really the discovery part is only what is needed so far.

However, the app, on start up, is now displaying this warning:

disable iguration$LoadBalancerCaffeineWarnLogger : Spring Cloud LoadBalancer is currently working with the default cache. You can switch to using Caffeine cache, by adding it to the classpath.

I am not sure why Spring Cloud LoadBalancer comes into the picture. I believe this is not needed in my use case.

My question is, how to fix this warning, and if possible, not by bringing any extra dependencies I do not need.

Thank you for your help.

-- PatPatPat
java
kubernetes
spring

1 Answer

7/31/2021

This can be fixed with the following property

  spring.cloud.loadbalancer.cache.enabled=false
-- PatPatPat
Source: StackOverflow