spring-cloud-commons icon indicating copy to clipboard operation
spring-cloud-commons copied to clipboard

Spring Cloud LoadBalancer default cache warning should take discovery client implementation into account

Open filpano opened this issue 5 months ago • 0 comments

When using the default cache, the following warning is logged:

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

As clarified in the docs via https://github.com/spring-cloud/spring-cloud-commons/pull/991, this is unnecessary if using a Service Discovery implementation which itself performs caching, such as EurekaDiscoveryClient.

IMO this is something that the framework can/should take into account. Supressing the warning if a known DiscoveryClient implementation is on the classpath (e.g. via @ConditionalOnClass or even a simple Class lookup).

A user seeing this warning will add e.g. Caffeine as a cache mechanism while potentially then introducing a buggy double-caching layer, unless they carefully read a specific section of the docs and/or are using a caching mechanism that does not contain caching itself (e.g. EurekaDiscoveryClient).

filpano avatar Jul 29 '25 17:07 filpano