From 3b99ba9d61b207679f8c31616c79d7b01b7e5a84 Mon Sep 17 00:00:00 2001 From: Stephane Nicoll Date: Tue, 31 Mar 2015 11:26:25 +0200 Subject: [PATCH] Add missing classpath checks Certain cache manager implementations are located in the spring-context-support module that isn't pulled automatically. As a result, the related cache auto-configurations should make sure that the relevant CacheManager implementation is available. See gh-2633 --- .../boot/autoconfigure/cache/GuavaCacheConfiguration.java | 2 +- .../boot/autoconfigure/cache/JCacheCacheConfiguration.java | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cache/GuavaCacheConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cache/GuavaCacheConfiguration.java index 62cf7731fc..3ae25e8f19 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cache/GuavaCacheConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cache/GuavaCacheConfiguration.java @@ -40,7 +40,7 @@ import com.google.common.cache.CacheLoader; * @since 1.3.0 */ @Configuration -@ConditionalOnClass(CacheBuilder.class) +@ConditionalOnClass({CacheBuilder.class,GuavaCacheManager.class}) @ConditionalOnMissingBean(CacheManager.class) @Conditional(CacheCondition.class) class GuavaCacheConfiguration { diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cache/JCacheCacheConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cache/JCacheCacheConfiguration.java index d33f38217e..0cdce464f7 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cache/JCacheCacheConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cache/JCacheCacheConfiguration.java @@ -18,7 +18,6 @@ package org.springframework.boot.autoconfigure.cache; import java.util.Iterator; import java.util.List; - import javax.cache.CacheManager; import javax.cache.Caching; import javax.cache.configuration.MutableConfiguration; @@ -49,7 +48,7 @@ import org.springframework.util.StringUtils; * @since 1.3.0 */ @Configuration -@ConditionalOnClass(Caching.class) +@ConditionalOnClass({Caching.class, JCacheCacheManager.class}) @ConditionalOnMissingBean(org.springframework.cache.CacheManager.class) @Conditional({ CacheCondition.class, JCacheCacheConfiguration.JCacheAvailableCondition.class })