From fcae5a7df80e011c80760db2df496a528d0e4023 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edd=C3=BA=20Mel=C3=A9ndez?= Date: Fri, 3 Apr 2015 03:52:58 -0500 Subject: [PATCH] Add missing type check on EhCacheCacheConfiguration Previously, EhCacheCacheConfiguration could be triggered even if the ehcache library is not present. This commit adds the missing `ConditionalOnType` that now guards the configuration properly. See gh-2633 --- .../boot/autoconfigure/cache/EhCacheCacheConfiguration.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cache/EhCacheCacheConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cache/EhCacheCacheConfiguration.java index 9d75e5b266..48ae1a2f3b 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cache/EhCacheCacheConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cache/EhCacheCacheConfiguration.java @@ -16,6 +16,8 @@ package org.springframework.boot.autoconfigure.cache; +import net.sf.ehcache.Cache; + import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; @@ -35,7 +37,7 @@ import org.springframework.core.io.Resource; * @since 1.3.0 */ @Configuration -@ConditionalOnClass(EhCacheCacheManager.class) +@ConditionalOnClass({Cache.class, EhCacheCacheManager.class}) @ConditionalOnMissingBean(CacheManager.class) @Conditional({ CacheCondition.class, EhCacheCacheConfiguration.ConfigAvailableCondition.class })