mirror of
https://github.com/spring-projects/spring-boot.git
synced 2026-09-22 09:09:01 +00:00
Properly guard cache statistics providers
Previously, a `NoClassDefFoundError` could be thrown if EhCache or Guava is on the classpath without `spring-context-support` as the respective cache statistics provider both needs the implementation and the spring abstraction implementation. The `@ConditionalOnClass` definition has been updated to properly guard those beans. Closes gh-3960
This commit is contained in:
+4
-2
@@ -36,6 +36,8 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
import org.springframework.cache.Cache;
|
||||
import org.springframework.cache.CacheManager;
|
||||
import org.springframework.cache.concurrent.ConcurrentMapCache;
|
||||
import org.springframework.cache.ehcache.EhCacheCache;
|
||||
import org.springframework.cache.guava.GuavaCache;
|
||||
import org.springframework.cache.jcache.JCacheCache;
|
||||
import org.springframework.cache.support.NoOpCacheManager;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
@@ -71,7 +73,7 @@ public class CacheStatisticsAutoConfiguration {
|
||||
}
|
||||
|
||||
@Configuration
|
||||
@ConditionalOnClass(Ehcache.class)
|
||||
@ConditionalOnClass({ EhCacheCache.class, Ehcache.class })
|
||||
static class EhCacheCacheStatisticsProviderConfiguration {
|
||||
|
||||
@Bean
|
||||
@@ -103,7 +105,7 @@ public class CacheStatisticsAutoConfiguration {
|
||||
}
|
||||
|
||||
@Configuration
|
||||
@ConditionalOnClass(com.google.common.cache.Cache.class)
|
||||
@ConditionalOnClass({ com.google.common.cache.Cache.class, GuavaCache.class })
|
||||
static class GuavaCacheStatisticsConfiguration {
|
||||
|
||||
@Bean
|
||||
|
||||
Reference in New Issue
Block a user