From bb8800a6256c99b2f6c4c63e9a61750ac6736b00 Mon Sep 17 00:00:00 2001 From: Stephane Nicoll Date: Fri, 3 Mar 2017 10:29:39 +0100 Subject: [PATCH] Deprecate spring.cache.hazelcast.config The additional configuration for an `HazelcastInstance` will be removed in 2.0. This commit makes sure that the property is deprecated in 1.5 See gh-8470 --- .../boot/autoconfigure/cache/CacheProperties.java | 5 +++++ .../cache/CacheAutoConfigurationTests.java | 3 +++ .../asciidoc/appendix-application-properties.adoc | 1 - .../src/main/asciidoc/spring-boot-features.adoc | 12 ------------ 4 files changed, 8 insertions(+), 13 deletions(-) diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cache/CacheProperties.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cache/CacheProperties.java index 4965f41a38..b0eed78bf0 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cache/CacheProperties.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cache/CacheProperties.java @@ -88,6 +88,7 @@ public class CacheProperties { return this.ehcache; } + @Deprecated public Hazelcast getHazelcast() { return this.hazelcast; } @@ -193,6 +194,7 @@ public class CacheProperties { /** * Hazelcast specific cache properties. */ + @Deprecated public static class Hazelcast { /** @@ -200,6 +202,9 @@ public class CacheProperties { */ private Resource config; + @DeprecatedConfigurationProperty(replacement = "spring.hazelcast.config", + reason = "Use general hazelcast auto-configuration instead.") + @Deprecated public Resource getConfig() { return this.config; } 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 1432592157..a54a49f1a6 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 @@ -451,6 +451,7 @@ public class CacheAutoConfigurationTests { } @Test + @Deprecated public void hazelcastCacheWithConfig() throws IOException { load(DefaultCacheConfiguration.class, "spring.cache.type=hazelcast", "spring.cache.hazelcast.config=org/springframework/boot/autoconfigure/cache/hazelcast-specific.xml"); @@ -469,6 +470,7 @@ public class CacheAutoConfigurationTests { } @Test + @Deprecated public void hazelcastWithWrongConfig() { this.thrown.expect(BeanCreationException.class); this.thrown.expectMessage("foo/bar/unknown.xml"); @@ -505,6 +507,7 @@ public class CacheAutoConfigurationTests { } @Test + @Deprecated public void hazelcastCacheWithMainHazelcastAutoConfigurationAndSeparateCacheConfig() throws IOException { String mainConfig = "org/springframework/boot/autoconfigure/hazelcast/hazelcast-specific.xml"; diff --git a/spring-boot-docs/src/main/asciidoc/appendix-application-properties.adoc b/spring-boot-docs/src/main/asciidoc/appendix-application-properties.adoc index 9adba7f721..0f011be5ed 100644 --- a/spring-boot-docs/src/main/asciidoc/appendix-application-properties.adoc +++ b/spring-boot-docs/src/main/asciidoc/appendix-application-properties.adoc @@ -72,7 +72,6 @@ content into your application; rather pick only the properties that you need. spring.cache.couchbase.expiration=0 # Entry expiration in milliseconds. By default the entries never expire. spring.cache.ehcache.config= # The location of the configuration file to use to initialize EhCache. spring.cache.guava.spec= # The spec to use to create caches. Check CacheBuilderSpec for more details on the spec format. - spring.cache.hazelcast.config= # The location of the configuration file to use to initialize Hazelcast. spring.cache.infinispan.config= # The location of the configuration file to use to initialize Infinispan. spring.cache.jcache.config= # The location of the configuration file to use to initialize the cache manager. spring.cache.jcache.provider= # Fully qualified name of the CachingProvider implementation to use to retrieve the JSR-107 compliant cache manager. Only needed if more than one JSR-107 implementation is available on the classpath. diff --git a/spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc b/spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc index ed1c8f6e26..5a4a0197e2 100644 --- a/spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc +++ b/spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc @@ -4163,18 +4163,6 @@ Spring Boot has a <>. If a `HazelcastInstance` has been auto-configured, it is automatically wrapped in a `CacheManager`. -If for some reason you need a different `HazelcastInstance` for caching, you can -request Spring Boot to create a separate one that will be only used by the -`CacheManager`: - -[source,properties,indent=0] ----- - spring.cache.hazelcast.config=classpath:config/my-cache-hazelcast.xml ----- - -TIP: If a separate `HazelcastInstance` is created that way, it is not registered -in the application context. - [[boot-features-caching-provider-infinispan]]