diff --git a/spring-boot-autoconfigure/pom.xml b/spring-boot-autoconfigure/pom.xml
index 2ce061f45f..b849689b3a 100644
--- a/spring-boot-autoconfigure/pom.xml
+++ b/spring-boot-autoconfigure/pom.xml
@@ -235,6 +235,11 @@
hornetq-jms-server
true
+
+ org.infinispan
+ infinispan-spring4
+ true
+
org.springframework
spring-jdbc
diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cache/CacheType.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cache/CacheType.java
index 3fbe3d54c1..8ac65ae4cd 100644
--- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cache/CacheType.java
+++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cache/CacheType.java
@@ -41,6 +41,11 @@ public enum CacheType {
*/
HAZELCAST(HazelcastCacheConfiguration.class),
+ /**
+ * Infinispan backed caching.
+ */
+ INFINISPAN(InfinispanCacheConfiguration.class),
+
/**
* JCache (JSR-107) backed caching.
*/
diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cache/InfinispanCacheConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cache/InfinispanCacheConfiguration.java
new file mode 100644
index 0000000000..7b5ec6456d
--- /dev/null
+++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cache/InfinispanCacheConfiguration.java
@@ -0,0 +1,69 @@
+/*
+ * Copyright 2012-2015 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.springframework.boot.autoconfigure.cache;
+
+import org.infinispan.manager.DefaultCacheManager;
+import org.infinispan.spring.provider.SpringEmbeddedCacheManager;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
+import org.springframework.cache.CacheManager;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Conditional;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.core.io.Resource;
+import org.springframework.util.CollectionUtils;
+
+import java.io.IOException;
+import java.util.List;
+
+/**
+ * Infinispan cache configuration.
+ *
+ * @author EddĂș MelĂ©ndez
+ * @since 1.3.0
+ */
+@Configuration
+@ConditionalOnClass(SpringEmbeddedCacheManager.class)
+@ConditionalOnMissingBean(CacheManager.class)
+@Conditional(CacheCondition.class)
+public class InfinispanCacheConfiguration {
+
+ @Autowired
+ private CacheProperties cacheProperties;
+
+ @Bean
+ public CacheManager cacheManager() throws IOException {
+ DefaultCacheManager defaultCacheManager = createCacheManager();
+ List cacheNames = this.cacheProperties.getCacheNames();
+ if (!CollectionUtils.isEmpty(cacheNames)) {
+ for (String cacheName : cacheNames) {
+ defaultCacheManager.startCache(cacheName);
+ }
+ }
+ return new SpringEmbeddedCacheManager(defaultCacheManager);
+ }
+
+ private DefaultCacheManager createCacheManager() throws IOException {
+ Resource location = this.cacheProperties.resolveConfigLocation();
+ if (location != null) {
+ return new DefaultCacheManager(this.cacheProperties.getConfig().getInputStream());
+ }
+ return new DefaultCacheManager();
+ }
+
+}
diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/cache/CacheAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/cache/CacheAutoConfigurationTests.java
index 46785d356a..8773787844 100644
--- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/cache/CacheAutoConfigurationTests.java
+++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/cache/CacheAutoConfigurationTests.java
@@ -380,6 +380,32 @@ public class CacheAutoConfigurationTests {
is(configResource.getURI()));
}
+ @Test
+ public void infinispanCacheWithCaches() {
+ SpringEmbeddedCacheManager cacheManager = null;
+ try {
+ load(DefaultCacheConfiguration.class, "spring.cache.type=infinispan",
+ "spring.cache.cacheNames[0]=foo", "spring.cache.cacheNames[1]=bar");
+ cacheManager = validateCacheManager(SpringEmbeddedCacheManager.class);
+ assertThat(cacheManager.getCacheNames(), containsInAnyOrder("foo", "bar"));
+ } finally {
+ cacheManager.stop();
+ }
+ }
+
+ @Test
+ public void infinispanCacheWithConfig() {
+ SpringEmbeddedCacheManager cacheManager = null;
+ try {
+ load(DefaultCacheConfiguration.class, "spring.cache.type=infinispan",
+ "spring.cache.config=infinispan.xml");
+ cacheManager = validateCacheManager(SpringEmbeddedCacheManager.class);
+ assertThat(cacheManager.getCacheNames(), containsInAnyOrder("foo", "bar"));
+ } finally {
+ cacheManager.stop();
+ }
+ }
+
@Test
public void jCacheCacheWithCachesAndCustomizer() {
String cachingProviderFqn = HazelcastCachingProvider.class.getName();
diff --git a/spring-boot-autoconfigure/src/test/resources/infinispan.xml b/spring-boot-autoconfigure/src/test/resources/infinispan.xml
new file mode 100644
index 0000000000..88d844365e
--- /dev/null
+++ b/spring-boot-autoconfigure/src/test/resources/infinispan.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/spring-boot-dependencies/pom.xml b/spring-boot-dependencies/pom.xml
index 2ea3753236..a7a5ef66ec 100644
--- a/spring-boot-dependencies/pom.xml
+++ b/spring-boot-dependencies/pom.xml
@@ -82,6 +82,7 @@
2.3.2
4.0.2
4.4.1
+ 7.2.1.Final
2.5.1
2.6.1
3.18.1-GA
@@ -1276,6 +1277,11 @@
hsqldb
${hsqldb.version}
+
+ org.infinispan
+ infinispan-spring4
+ ${infinispan.version}
+
org.javassist
javassist
@@ -1849,4 +1855,4 @@
integration-test
-
\ No newline at end of file
+