Commit 207ab3ec authored by Stephane Nicoll's avatar Stephane Nicoll

Merge branch '1.4.x' into 1.5.x

parents 50c0204f 07c56c60
/*
* Copyright 2012-2017 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 java.io.IOException;
import java.net.URI;
import java.util.Properties;
import com.hazelcast.core.HazelcastInstance;
import org.springframework.beans.factory.ObjectProvider;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.io.Resource;
/**
* JCache customization for Hazelcast.
*
* @author Stephane Nicoll
*/
@Configuration
@ConditionalOnClass(HazelcastInstance.class)
class HazelcastJCacheCustomizationConfiguration {
@Bean
public HazelcastPropertiesCustomizer hazelcastPropertiesCustomizer(
ObjectProvider<HazelcastInstance> hazelcastInstance) {
return new HazelcastPropertiesCustomizer(
hazelcastInstance.getIfUnique());
}
private static class HazelcastPropertiesCustomizer
implements JCachePropertiesCustomizer {
private final HazelcastInstance hazelcastInstance;
HazelcastPropertiesCustomizer(HazelcastInstance hazelcastInstance) {
this.hazelcastInstance = hazelcastInstance;
}
@Override
public void customize(CacheProperties cacheProperties, Properties properties) {
Resource configLocation = cacheProperties
.resolveConfigLocation(cacheProperties.getJcache().getConfig());
if (configLocation != null) {
// Hazelcast does not use the URI as a mean to specify a custom config.
properties.setProperty("hazelcast.config.location",
toUri(configLocation).toString());
}
else if (this.hazelcastInstance != null) {
properties.put("hazelcast.instance.itself", this.hazelcastInstance);
}
}
private static URI toUri(Resource config) {
try {
return config.getURI();
}
catch (IOException ex) {
throw new IllegalArgumentException(
"Could not get URI from " + config, ex);
}
}
}
}
...@@ -40,6 +40,7 @@ import org.springframework.context.annotation.Bean; ...@@ -40,6 +40,7 @@ import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ConditionContext; import org.springframework.context.annotation.ConditionContext;
import org.springframework.context.annotation.Conditional; import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.core.Ordered; import org.springframework.core.Ordered;
import org.springframework.core.annotation.AnnotationAwareOrderComparator; import org.springframework.core.annotation.AnnotationAwareOrderComparator;
import org.springframework.core.annotation.Order; import org.springframework.core.annotation.Order;
...@@ -59,6 +60,7 @@ import org.springframework.util.StringUtils; ...@@ -59,6 +60,7 @@ import org.springframework.util.StringUtils;
@ConditionalOnMissingBean(org.springframework.cache.CacheManager.class) @ConditionalOnMissingBean(org.springframework.cache.CacheManager.class)
@Conditional({ CacheCondition.class, @Conditional({ CacheCondition.class,
JCacheCacheConfiguration.JCacheAvailableCondition.class }) JCacheCacheConfiguration.JCacheAvailableCondition.class })
@Import(HazelcastJCacheCustomizationConfiguration.class)
class JCacheCacheConfiguration { class JCacheCacheConfiguration {
private final CacheProperties cacheProperties; private final CacheProperties cacheProperties;
...@@ -69,14 +71,18 @@ class JCacheCacheConfiguration { ...@@ -69,14 +71,18 @@ class JCacheCacheConfiguration {
private final List<JCacheManagerCustomizer> cacheManagerCustomizers; private final List<JCacheManagerCustomizer> cacheManagerCustomizers;
private final List<JCachePropertiesCustomizer> cachePropertiesCustomizers;
JCacheCacheConfiguration(CacheProperties cacheProperties, JCacheCacheConfiguration(CacheProperties cacheProperties,
CacheManagerCustomizers customizers, CacheManagerCustomizers customizers,
ObjectProvider<javax.cache.configuration.Configuration<?, ?>> defaultCacheConfiguration, ObjectProvider<javax.cache.configuration.Configuration<?, ?>> defaultCacheConfiguration,
ObjectProvider<List<JCacheManagerCustomizer>> cacheManagerCustomizers) { ObjectProvider<List<JCacheManagerCustomizer>> cacheManagerCustomizers,
ObjectProvider<List<JCachePropertiesCustomizer>> cachePropertiesCustomizers) {
this.cacheProperties = cacheProperties; this.cacheProperties = cacheProperties;
this.customizers = customizers; this.customizers = customizers;
this.defaultCacheConfiguration = defaultCacheConfiguration.getIfAvailable(); this.defaultCacheConfiguration = defaultCacheConfiguration.getIfAvailable();
this.cacheManagerCustomizers = cacheManagerCustomizers.getIfAvailable(); this.cacheManagerCustomizers = cacheManagerCustomizers.getIfAvailable();
this.cachePropertiesCustomizers = cachePropertiesCustomizers.getIfAvailable();
} }
@Bean @Bean
...@@ -102,14 +108,14 @@ class JCacheCacheConfiguration { ...@@ -102,14 +108,14 @@ class JCacheCacheConfiguration {
private CacheManager createCacheManager() throws IOException { private CacheManager createCacheManager() throws IOException {
CachingProvider cachingProvider = getCachingProvider( CachingProvider cachingProvider = getCachingProvider(
this.cacheProperties.getJcache().getProvider()); this.cacheProperties.getJcache().getProvider());
Properties properties = createCacheManagerProperties();
Resource configLocation = this.cacheProperties Resource configLocation = this.cacheProperties
.resolveConfigLocation(this.cacheProperties.getJcache().getConfig()); .resolveConfigLocation(this.cacheProperties.getJcache().getConfig());
if (configLocation != null) { if (configLocation != null) {
return cachingProvider.getCacheManager(configLocation.getURI(), return cachingProvider.getCacheManager(configLocation.getURI(),
cachingProvider.getDefaultClassLoader(), cachingProvider.getDefaultClassLoader(), properties);
createCacheManagerProperties(configLocation));
} }
return cachingProvider.getCacheManager(); return cachingProvider.getCacheManager(null, null, properties);
} }
private CachingProvider getCachingProvider(String cachingProviderFqn) { private CachingProvider getCachingProvider(String cachingProviderFqn) {
...@@ -119,12 +125,13 @@ class JCacheCacheConfiguration { ...@@ -119,12 +125,13 @@ class JCacheCacheConfiguration {
return Caching.getCachingProvider(); return Caching.getCachingProvider();
} }
private Properties createCacheManagerProperties(Resource configLocation) private Properties createCacheManagerProperties() {
throws IOException {
Properties properties = new Properties(); Properties properties = new Properties();
// Hazelcast does not use the URI as a mean to specify a custom config. if (this.cachePropertiesCustomizers != null) {
properties.setProperty("hazelcast.config.location", for (JCachePropertiesCustomizer customizer : this.cachePropertiesCustomizers) {
configLocation.getURI().toString()); customizer.customize(this.cacheProperties, properties);
}
}
return properties; return properties;
} }
......
/*
* Copyright 2012-2017 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 java.util.Properties;
import javax.cache.CacheManager;
import javax.cache.spi.CachingProvider;
/**
* Callback interface that can be implemented by beans wishing to customize the properties
* used by the {@link CachingProvider} to create the {@link CacheManager}.
*
* @author Stephane Nicoll
*/
interface JCachePropertiesCustomizer {
/**
* Customize the properties.
* @param cacheProperties the cache properties
* @param properties the current properties
* @see CachingProvider#getCacheManager(java.net.URI, ClassLoader, Properties)
*/
void customize(CacheProperties cacheProperties, Properties properties);
}
...@@ -38,6 +38,7 @@ import com.github.benmanes.caffeine.cache.Caffeine; ...@@ -38,6 +38,7 @@ import com.github.benmanes.caffeine.cache.Caffeine;
import com.github.benmanes.caffeine.cache.CaffeineSpec; import com.github.benmanes.caffeine.cache.CaffeineSpec;
import com.google.common.cache.CacheBuilder; import com.google.common.cache.CacheBuilder;
import com.hazelcast.cache.HazelcastCachingProvider; import com.hazelcast.cache.HazelcastCachingProvider;
import com.hazelcast.core.Hazelcast;
import com.hazelcast.core.HazelcastInstance; import com.hazelcast.core.HazelcastInstance;
import com.hazelcast.spring.cache.HazelcastCacheManager; import com.hazelcast.spring.cache.HazelcastCacheManager;
import net.sf.ehcache.Status; import net.sf.ehcache.Status;
...@@ -53,7 +54,6 @@ import org.junit.rules.ExpectedException; ...@@ -53,7 +54,6 @@ import org.junit.rules.ExpectedException;
import org.springframework.beans.DirectFieldAccessor; import org.springframework.beans.DirectFieldAccessor;
import org.springframework.beans.factory.BeanCreationException; import org.springframework.beans.factory.BeanCreationException;
import org.springframework.beans.factory.NoSuchBeanDefinitionException; import org.springframework.beans.factory.NoSuchBeanDefinitionException;
import org.springframework.boot.autoconfigure.ImportAutoConfiguration;
import org.springframework.boot.autoconfigure.cache.support.MockCachingProvider; import org.springframework.boot.autoconfigure.cache.support.MockCachingProvider;
import org.springframework.boot.autoconfigure.hazelcast.HazelcastAutoConfiguration; import org.springframework.boot.autoconfigure.hazelcast.HazelcastAutoConfiguration;
import org.springframework.boot.test.util.EnvironmentTestUtils; import org.springframework.boot.test.util.EnvironmentTestUtils;
...@@ -433,8 +433,9 @@ public class CacheAutoConfigurationTests { ...@@ -433,8 +433,9 @@ public class CacheAutoConfigurationTests {
} }
@Test @Test
public void hazelcastCacheExplicit() { public void hazelcastCacheExplicit() { // Fail
load(DefaultCacheConfiguration.class, "spring.cache.type=hazelcast"); load(new Class[] { HazelcastAutoConfiguration.class,
DefaultCacheConfiguration.class }, "spring.cache.type=hazelcast");
HazelcastCacheManager cacheManager = validateCacheManager( HazelcastCacheManager cacheManager = validateCacheManager(
HazelcastCacheManager.class); HazelcastCacheManager.class);
// NOTE: the hazelcast implementation knows about a cache in a lazy manner. // NOTE: the hazelcast implementation knows about a cache in a lazy manner.
...@@ -446,7 +447,7 @@ public class CacheAutoConfigurationTests { ...@@ -446,7 +447,7 @@ public class CacheAutoConfigurationTests {
@Test @Test
public void hazelcastCacheWithCustomizers() { public void hazelcastCacheWithCustomizers() {
testCustomizers(DefaultCacheAndCustomizersConfiguration.class, "hazelcast", testCustomizers(HazelcastCacheAndCustomizersConfiguration.class, "hazelcast",
"allCacheManagerCustomizer", "hazelcastCacheManagerCustomizer"); "allCacheManagerCustomizer", "hazelcastCacheManagerCustomizer");
} }
...@@ -488,15 +489,11 @@ public class CacheAutoConfigurationTests { ...@@ -488,15 +489,11 @@ public class CacheAutoConfigurationTests {
} }
@Test @Test
public void hazelcastCacheWithMainHazelcastAutoConfiguration() throws IOException { public void hazelcastCacheWithHazelcastAutoConfiguration() throws IOException {
String mainConfig = "org/springframework/boot/autoconfigure/hazelcast/hazelcast-specific.xml"; String mainConfig = "org/springframework/boot/autoconfigure/hazelcast/hazelcast-specific.xml";
AnnotationConfigApplicationContext applicationContext = new AnnotationConfigApplicationContext(); load(new Class[] { HazelcastAutoConfiguration.class,
EnvironmentTestUtils.addEnvironment(applicationContext, DefaultCacheConfiguration.class }, "spring.cache.type=hazelcast",
"spring.cache.type=hazelcast", "spring.hazelcast.config=" + mainConfig); "spring.hazelcast.config=" + mainConfig);
applicationContext.register(DefaultCacheConfiguration.class);
applicationContext.register(HazelcastAndCacheConfiguration.class);
applicationContext.refresh();
this.context = applicationContext;
HazelcastCacheManager cacheManager = validateCacheManager( HazelcastCacheManager cacheManager = validateCacheManager(
HazelcastCacheManager.class); HazelcastCacheManager.class);
HazelcastInstance hazelcastInstance = this.context HazelcastInstance hazelcastInstance = this.context
...@@ -504,6 +501,8 @@ public class CacheAutoConfigurationTests { ...@@ -504,6 +501,8 @@ public class CacheAutoConfigurationTests {
assertThat(cacheManager.getHazelcastInstance()).isEqualTo(hazelcastInstance); assertThat(cacheManager.getHazelcastInstance()).isEqualTo(hazelcastInstance);
assertThat(hazelcastInstance.getConfig().getConfigurationFile()) assertThat(hazelcastInstance.getConfig().getConfigurationFile())
.isEqualTo(new ClassPathResource(mainConfig).getFile()); .isEqualTo(new ClassPathResource(mainConfig).getFile());
assertThat(cacheManager.getCache("foobar")).isNotNull();
assertThat(cacheManager.getCacheNames()).containsOnly("foobar");
} }
@Test @Test
...@@ -512,15 +511,10 @@ public class CacheAutoConfigurationTests { ...@@ -512,15 +511,10 @@ public class CacheAutoConfigurationTests {
throws IOException { throws IOException {
String mainConfig = "org/springframework/boot/autoconfigure/hazelcast/hazelcast-specific.xml"; String mainConfig = "org/springframework/boot/autoconfigure/hazelcast/hazelcast-specific.xml";
String cacheConfig = "org/springframework/boot/autoconfigure/cache/hazelcast-specific.xml"; String cacheConfig = "org/springframework/boot/autoconfigure/cache/hazelcast-specific.xml";
AnnotationConfigApplicationContext applicationContext = new AnnotationConfigApplicationContext(); load(new Class[] { HazelcastAutoConfiguration.class,
EnvironmentTestUtils.addEnvironment(applicationContext, DefaultCacheConfiguration.class }, "spring.cache.type=hazelcast",
"spring.cache.type=hazelcast",
"spring.cache.hazelcast.config=" + cacheConfig, "spring.cache.hazelcast.config=" + cacheConfig,
"spring.hazelcast.config=" + mainConfig); "spring.hazelcast.config=" + mainConfig);
applicationContext.register(DefaultCacheConfiguration.class);
applicationContext.register(HazelcastAndCacheConfiguration.class);
applicationContext.refresh();
this.context = applicationContext;
HazelcastInstance hazelcastInstance = this.context HazelcastInstance hazelcastInstance = this.context
.getBean(HazelcastInstance.class); .getBean(HazelcastInstance.class);
HazelcastCacheManager cacheManager = validateCacheManager( HazelcastCacheManager cacheManager = validateCacheManager(
...@@ -543,6 +537,7 @@ public class CacheAutoConfigurationTests { ...@@ -543,6 +537,7 @@ public class CacheAutoConfigurationTests {
JCacheCacheManager cacheManager = validateCacheManager( JCacheCacheManager cacheManager = validateCacheManager(
JCacheCacheManager.class); JCacheCacheManager.class);
assertThat(cacheManager.getCacheNames()).containsOnly("foo", "bar"); assertThat(cacheManager.getCacheNames()).containsOnly("foo", "bar");
assertThat(Hazelcast.getAllHazelcastInstances()).hasSize(1);
} }
finally { finally {
Caching.getCachingProvider(cachingProviderFqn).close(); Caching.getCachingProvider(cachingProviderFqn).close();
...@@ -552,15 +547,65 @@ public class CacheAutoConfigurationTests { ...@@ -552,15 +547,65 @@ public class CacheAutoConfigurationTests {
@Test @Test
public void hazelcastAsJCacheWithConfig() throws IOException { public void hazelcastAsJCacheWithConfig() throws IOException {
String cachingProviderFqn = HazelcastCachingProvider.class.getName(); String cachingProviderFqn = HazelcastCachingProvider.class.getName();
String configLocation = "org/springframework/boot/autoconfigure/cache/hazelcast-specific.xml"; try {
load(DefaultCacheConfiguration.class, "spring.cache.type=jcache", String configLocation = "org/springframework/boot/autoconfigure/cache/hazelcast-specific.xml";
"spring.cache.jcache.provider=" + cachingProviderFqn, load(DefaultCacheConfiguration.class, "spring.cache.type=jcache",
"spring.cache.jcache.config=" + configLocation); "spring.cache.jcache.provider=" + cachingProviderFqn,
"spring.cache.jcache.config=" + configLocation);
JCacheCacheManager cacheManager = validateCacheManager(JCacheCacheManager.class);
Resource configResource = new ClassPathResource(configLocation);
assertThat(cacheManager.getCacheManager().getURI())
.isEqualTo(configResource.getURI());
assertThat(Hazelcast.getAllHazelcastInstances()).hasSize(1);
}
finally {
Caching.getCachingProvider(cachingProviderFqn).close();
}
}
@Test
public void hazelcastAsJCacheWithExistingHazelcastInstance() throws IOException {
String cachingProviderFqn = HazelcastCachingProvider.class.getName();
load(new Class[] { HazelcastAutoConfiguration.class,
DefaultCacheConfiguration.class }, "spring.cache.type=jcache",
"spring.cache.jcache.provider=" + cachingProviderFqn);
JCacheCacheManager cacheManager = validateCacheManager(JCacheCacheManager.class); JCacheCacheManager cacheManager = validateCacheManager(JCacheCacheManager.class);
javax.cache.CacheManager jCacheManager = cacheManager.getCacheManager();
assertThat(jCacheManager).isInstanceOf(
com.hazelcast.cache.HazelcastCacheManager.class);
assertThat(this.context.getBeansOfType(HazelcastInstance.class)).hasSize(1);
HazelcastInstance hazelcastInstance = this.context.getBean(HazelcastInstance.class);
assertThat(((com.hazelcast.cache.HazelcastCacheManager) jCacheManager)
.getHazelcastInstance()).isSameAs(hazelcastInstance);
assertThat(hazelcastInstance.getName()).isEqualTo("default-instance");
assertThat(Hazelcast.getAllHazelcastInstances()).hasSize(1);
}
Resource configResource = new ClassPathResource(configLocation); @Test
public void hazelcastAsJCacheWithMainHazelcastAutoConfigurationAndSeparateCacheConfig()
throws IOException {
String cachingProviderFqn = HazelcastCachingProvider.class.getName();
String mainConfig = "org/springframework/boot/autoconfigure/hazelcast/hazelcast-specific.xml";
String cacheConfig = "org/springframework/boot/autoconfigure/cache/hazelcast-specific.xml";
load(new Class[] { HazelcastAutoConfiguration.class,
DefaultCacheConfiguration.class }, "spring.cache.type=jcache",
"spring.cache.jcache.provider=" + cachingProviderFqn,
"spring.cache.jcache.config=" + cacheConfig,
"spring.hazelcast.config=" + mainConfig);
JCacheCacheManager cacheManager = validateCacheManager(JCacheCacheManager.class);
javax.cache.CacheManager jCacheManager = cacheManager.getCacheManager();
assertThat(jCacheManager).isInstanceOf(
com.hazelcast.cache.HazelcastCacheManager.class);
assertThat(this.context.getBeansOfType(HazelcastInstance.class)).hasSize(1);
HazelcastInstance hazelcastInstance = this.context.getBean(HazelcastInstance.class);
assertThat(((com.hazelcast.cache.HazelcastCacheManager) jCacheManager)
.getHazelcastInstance()).isNotSameAs(hazelcastInstance);
assertThat(hazelcastInstance.getConfig().getConfigurationFile())
.isEqualTo(new ClassPathResource(mainConfig).getFile());
assertThat(cacheManager.getCacheManager().getURI()) assertThat(cacheManager.getCacheManager().getURI())
.isEqualTo(configResource.getURI()); .isEqualTo(new ClassPathResource(cacheConfig).getURI());
assertThat(Hazelcast.getAllHazelcastInstances()).hasSize(2);
} }
@Test @Test
...@@ -624,14 +669,19 @@ public class CacheAutoConfigurationTests { ...@@ -624,14 +669,19 @@ public class CacheAutoConfigurationTests {
} }
@Test @Test
public void jCacheCacheWithCachesAndCustomizer() { public void jCacheCacheWithCachesAndCustomizer() { // this one
String cachingProviderFqn = HazelcastCachingProvider.class.getName(); String cachingProviderFqn = HazelcastCachingProvider.class.getName();
load(JCacheWithCustomizerConfiguration.class, "spring.cache.type=jcache", try {
"spring.cache.jcache.provider=" + cachingProviderFqn, load(JCacheWithCustomizerConfiguration.class, "spring.cache.type=jcache",
"spring.cache.cacheNames[0]=foo", "spring.cache.cacheNames[1]=bar"); "spring.cache.jcache.provider=" + cachingProviderFqn,
JCacheCacheManager cacheManager = validateCacheManager(JCacheCacheManager.class); "spring.cache.cacheNames[0]=foo", "spring.cache.cacheNames[1]=bar");
// see customizer JCacheCacheManager cacheManager = validateCacheManager(JCacheCacheManager.class);
assertThat(cacheManager.getCacheNames()).containsOnly("foo", "custom1"); // see customizer
assertThat(cacheManager.getCacheNames()).containsOnly("foo", "custom1");
}
finally {
Caching.getCachingProvider(cachingProviderFqn).close();
}
} }
@Test @Test
...@@ -754,9 +804,13 @@ public class CacheAutoConfigurationTests { ...@@ -754,9 +804,13 @@ public class CacheAutoConfigurationTests {
} }
private void load(Class<?> config, String... environment) { private void load(Class<?> config, String... environment) {
load(new Class[] { config }, environment);
}
private void load(Class<?>[] configs, String... environment) {
AnnotationConfigApplicationContext applicationContext = new AnnotationConfigApplicationContext(); AnnotationConfigApplicationContext applicationContext = new AnnotationConfigApplicationContext();
EnvironmentTestUtils.addEnvironment(applicationContext, environment); EnvironmentTestUtils.addEnvironment(applicationContext, environment);
applicationContext.register(config); applicationContext.register(configs);
applicationContext.register(CacheAutoConfiguration.class); applicationContext.register(CacheAutoConfiguration.class);
applicationContext.refresh(); applicationContext.refresh();
this.context = applicationContext; this.context = applicationContext;
...@@ -803,6 +857,14 @@ public class CacheAutoConfigurationTests { ...@@ -803,6 +857,14 @@ public class CacheAutoConfigurationTests {
} }
@Configuration
@EnableCaching
@Import({ HazelcastAutoConfiguration.class,
CacheManagerCustomizersConfiguration.class })
static class HazelcastCacheAndCustomizersConfiguration {
}
@Configuration @Configuration
@EnableCaching @EnableCaching
static class CouchbaseCacheConfiguration { static class CouchbaseCacheConfiguration {
...@@ -913,13 +975,6 @@ public class CacheAutoConfigurationTests { ...@@ -913,13 +975,6 @@ public class CacheAutoConfigurationTests {
} }
@Configuration
@ImportAutoConfiguration({ CacheAutoConfiguration.class,
HazelcastAutoConfiguration.class })
static class HazelcastAndCacheConfiguration {
}
@Configuration @Configuration
@EnableCaching @EnableCaching
static class InfinispanCustomConfiguration { static class InfinispanCustomConfiguration {
......
...@@ -3,6 +3,8 @@ ...@@ -3,6 +3,8 @@
xmlns="http://www.hazelcast.com/schema/config" xmlns="http://www.hazelcast.com/schema/config"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<instance-name>default-instance</instance-name>
<map name="defaultCache" /> <map name="defaultCache" />
<network> <network>
......
...@@ -4128,6 +4128,10 @@ NOTE: Since a cache library may offer both a native implementation and JSR-107 s ...@@ -4128,6 +4128,10 @@ NOTE: Since a cache library may offer both a native implementation and JSR-107 s
Spring Boot will prefer the JSR-107 support so that the same features are available if Spring Boot will prefer the JSR-107 support so that the same features are available if
you switch to a different JSR-107 implementation. you switch to a different JSR-107 implementation.
TIP: Spring Boot has a <<boot-features-hazelcast,general support for Hazelcast>>t. If
a single `HazelcastInstance` is available, it is automatically reused for the
`CacheManager` as well unless the `spring.cache.jcache.config` property is specified.
There are several ways to customize the underlying `javax.cache.cacheManager`: There are several ways to customize the underlying `javax.cache.cacheManager`:
* Caches can be created on startup via the `spring.cache.cache-names` property. If a * Caches can be created on startup via the `spring.cache.cache-names` property. If a
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment