IGNITE-14264 Fixes cache creation by IgniteClientSpringCacheManager with invalid name. (#48)
diff --git a/modules/spring-cache-ext/README.txt b/modules/spring-cache-ext/README.txt
index 85cb178..04eaedc 100644
--- a/modules/spring-cache-ext/README.txt
+++ b/modules/spring-cache-ext/README.txt
@@ -3,6 +3,11 @@
Apache Ignite Spring Cache extension provides an integration with Spring Cache framework.
+There are two implementations of Apache Ignite Spring Cache Manager - org.apache.ignite.cache.spring.SpringCacheManager and
+org.apache.ignite.cache.spring.IgniteClientSpringCacheManager, that provide ability to use the Ignite thick or thin client to
+connect to the Ignite cluster and manage Ignite caches, respectively. Note, that org.apache.ignite.cache.spring.IgniteClientSpringCacheManager
+can be used only with Ignite since 2.11.0 version.
+
Importing Spring Cache extension In Maven Project
----------------------------------------
diff --git a/modules/spring-cache-ext/src/main/java/org/apache/ignite/cache/spring/IgniteClientSpringCacheManager.java b/modules/spring-cache-ext/src/main/java/org/apache/ignite/cache/spring/IgniteClientSpringCacheManager.java
index ab39040..317458f 100644
--- a/modules/spring-cache-ext/src/main/java/org/apache/ignite/cache/spring/IgniteClientSpringCacheManager.java
+++ b/modules/spring-cache-ext/src/main/java/org/apache/ignite/cache/spring/IgniteClientSpringCacheManager.java
@@ -36,6 +36,8 @@
* set before manager use (see {@link #setClientInstance(IgniteClient),
* {@link #setClientConfiguration(ClientConfiguration)}}).
*
+ * Note that current manager implementation can be used only with Ignite since 2.11.0 version.
+ * For Ignite versions earlier than 2.11.0 use an {@link SpringCacheManager}.
*
* Note that Spring Cache synchronous mode ({@link Cacheable#sync}) is not supported by the current manager
* implementation. Instead, use an {@link SpringCacheManager} that uses an Ignite thick client to connect to Ignite cluster.
@@ -148,8 +150,7 @@
/** Gets dynamic Ignite cache configuration template. */
public ClientCacheConfiguration getDynamicCacheConfiguration() {
- // To avoid copying the dynamic cache configuration each time as we only change its name.
- return dynamicCacheCfg == null ? null : dynamicCacheCfg.setName(null);
+ return dynamicCacheCfg;
}
/**
@@ -164,8 +165,10 @@
}
/** {@inheritDoc} */
- @Override protected synchronized SpringCache createCache(String name) {
- ClientCacheConfiguration ccfg = dynamicCacheCfg == null ? new ClientCacheConfiguration() : dynamicCacheCfg;
+ @Override protected SpringCache createCache(String name) {
+ ClientCacheConfiguration ccfg = dynamicCacheCfg == null
+ ? new ClientCacheConfiguration()
+ : new ClientCacheConfiguration(dynamicCacheCfg);
ClientCache<Object, Object> cache = cli.getOrCreateCache(ccfg.setName(name));