Skip to content

Commit bb8800a

Browse files
committed
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
1 parent d4b52a3 commit bb8800a

File tree

4 files changed

+8
-13
lines changed

4 files changed

+8
-13
lines changed

spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cache/CacheProperties.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ public EhCache getEhcache() {
8888
return this.ehcache;
8989
}
9090

91+
@Deprecated
9192
public Hazelcast getHazelcast() {
9293
return this.hazelcast;
9394
}
@@ -193,13 +194,17 @@ public void setConfig(Resource config) {
193194
/**
194195
* Hazelcast specific cache properties.
195196
*/
197+
@Deprecated
196198
public static class Hazelcast {
197199

198200
/**
199201
* The location of the configuration file to use to initialize Hazelcast.
200202
*/
201203
private Resource config;
202204

205+
@DeprecatedConfigurationProperty(replacement = "spring.hazelcast.config",
206+
reason = "Use general hazelcast auto-configuration instead.")
207+
@Deprecated
203208
public Resource getConfig() {
204209
return this.config;
205210
}

spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/cache/CacheAutoConfigurationTests.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -451,6 +451,7 @@ public void hazelcastCacheWithCustomizers() {
451451
}
452452

453453
@Test
454+
@Deprecated
454455
public void hazelcastCacheWithConfig() throws IOException {
455456
load(DefaultCacheConfiguration.class, "spring.cache.type=hazelcast",
456457
"spring.cache.hazelcast.config=org/springframework/boot/autoconfigure/cache/hazelcast-specific.xml");
@@ -469,6 +470,7 @@ public void hazelcastCacheWithConfig() throws IOException {
469470
}
470471

471472
@Test
473+
@Deprecated
472474
public void hazelcastWithWrongConfig() {
473475
this.thrown.expect(BeanCreationException.class);
474476
this.thrown.expectMessage("foo/bar/unknown.xml");
@@ -505,6 +507,7 @@ public void hazelcastCacheWithMainHazelcastAutoConfiguration() throws IOExceptio
505507
}
506508

507509
@Test
510+
@Deprecated
508511
public void hazelcastCacheWithMainHazelcastAutoConfigurationAndSeparateCacheConfig()
509512
throws IOException {
510513
String mainConfig = "org/springframework/boot/autoconfigure/hazelcast/hazelcast-specific.xml";

spring-boot-docs/src/main/asciidoc/appendix-application-properties.adoc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ content into your application; rather pick only the properties that you need.
7272
spring.cache.couchbase.expiration=0 # Entry expiration in milliseconds. By default the entries never expire.
7373
spring.cache.ehcache.config= # The location of the configuration file to use to initialize EhCache.
7474
spring.cache.guava.spec= # The spec to use to create caches. Check CacheBuilderSpec for more details on the spec format.
75-
spring.cache.hazelcast.config= # The location of the configuration file to use to initialize Hazelcast.
7675
spring.cache.infinispan.config= # The location of the configuration file to use to initialize Infinispan.
7776
spring.cache.jcache.config= # The location of the configuration file to use to initialize the cache manager.
7877
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.

spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4163,18 +4163,6 @@ Spring Boot has a <<boot-features-hazelcast,general support for Hazelcast>>. If
41634163
a `HazelcastInstance` has been auto-configured, it is automatically wrapped in a
41644164
`CacheManager`.
41654165

4166-
If for some reason you need a different `HazelcastInstance` for caching, you can
4167-
request Spring Boot to create a separate one that will be only used by the
4168-
`CacheManager`:
4169-
4170-
[source,properties,indent=0]
4171-
----
4172-
spring.cache.hazelcast.config=classpath:config/my-cache-hazelcast.xml
4173-
----
4174-
4175-
TIP: If a separate `HazelcastInstance` is created that way, it is not registered
4176-
in the application context.
4177-
41784166

41794167

41804168
[[boot-features-caching-provider-infinispan]]

0 commit comments

Comments
 (0)