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
This commit is contained in:
Stephane Nicoll 2017-03-03 10:29:39 +01:00
parent d4b52a3538
commit bb8800a625
4 changed files with 8 additions and 13 deletions

View File

@ -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;
}

View File

@ -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";

View File

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

View File

@ -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]]