Browse Source

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
pull/8516/head
Stephane Nicoll 9 years ago
parent
commit
bb8800a625
  1. 5
      spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cache/CacheProperties.java
  2. 3
      spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/cache/CacheAutoConfigurationTests.java
  3. 1
      spring-boot-docs/src/main/asciidoc/appendix-application-properties.adoc
  4. 12
      spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc

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

@ -88,6 +88,7 @@ public class CacheProperties { @@ -88,6 +88,7 @@ public class CacheProperties {
return this.ehcache;
}
@Deprecated
public Hazelcast getHazelcast() {
return this.hazelcast;
}
@ -193,6 +194,7 @@ public class CacheProperties { @@ -193,6 +194,7 @@ public class CacheProperties {
/**
* Hazelcast specific cache properties.
*/
@Deprecated
public static class Hazelcast {
/**
@ -200,6 +202,9 @@ public class CacheProperties { @@ -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;
}

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

@ -451,6 +451,7 @@ public class CacheAutoConfigurationTests { @@ -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 { @@ -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 { @@ -505,6 +507,7 @@ public class CacheAutoConfigurationTests {
}
@Test
@Deprecated
public void hazelcastCacheWithMainHazelcastAutoConfigurationAndSeparateCacheConfig()
throws IOException {
String mainConfig = "org/springframework/boot/autoconfigure/hazelcast/hazelcast-specific.xml";

1
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. @@ -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.

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

@ -4163,18 +4163,6 @@ Spring Boot has a <<boot-features-hazelcast,general support for Hazelcast>>. If @@ -4163,18 +4163,6 @@ Spring Boot has a <<boot-features-hazelcast,general support for Hazelcast>>. 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]]

Loading…
Cancel
Save