This is an automated email from the ASF dual-hosted git repository.
namelchev pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git
The following commit(s) were added to refs/heads/master by this push:
new a567679 IGNITE-14399 Document thin client support for Ignite Spring
Cache integration. (#9509)
a567679 is described below
commit a567679bcd2e188c30ca1d9f378e55955a115e10
Author: Mikhail Petrov <[email protected]>
AuthorDate: Mon Oct 25 15:50:33 2021 +0300
IGNITE-14399 Document thin client support for Ignite Spring Cache
integration. (#9509)
---
.../spring/spring-caching.adoc | 382 +++++++++++++++++++--
.../spring/spring-tx.adoc | 90 +++--
2 files changed, 413 insertions(+), 59 deletions(-)
diff --git a/docs/_docs/extensions-and-integrations/spring/spring-caching.adoc
b/docs/_docs/extensions-and-integrations/spring/spring-caching.adoc
index bc57399..437c467 100644
--- a/docs/_docs/extensions-and-integrations/spring/spring-caching.adoc
+++ b/docs/_docs/extensions-and-integrations/spring/spring-caching.adoc
@@ -16,25 +16,133 @@
== Overview
-Ignite is shipped with `SpringCacheManager` - an implementation of
http://docs.spring.io/spring/docs/current/spring-framework-reference/html/cache.html[Spring
Cache Abstraction, window=_blank].
-It provides an annotation-based way to enable caching for Java methods so that
the result of a method execution is stored
-in an Ignite cache. Later, if the same method is called with the same set of
parameter values, the result will be retrieved
-from the cache instead of actually executing the method.
+http://docs.spring.io/spring/docs/current/spring-framework-reference/html/cache.html[Spring
Cache, window=_blank]
+abstraction provides an annotation-based way to enable caching for Java
methods so that the result of a method execution
+is stored in an external cache storage. Later, if the same method is called
with the same set of parameter values, the result
+will be retrieved from the cache instead of actually executing the method.
-== Enabling Ignite for Spring Caching
+Apache Ignite provides the `ignite-spring-cache-ext` extension that allows to
use Apache Ignite Cache as an external
+storage for the Spring Cache abstraction. The mentioned above integration is
achieved by providing implementations of the
+`CacheManager` Spring interface. There are two such implementations:
`SpringCacheManager` and
+`IgniteClientSpringCacheManager`, which use either Apache Ignite node or
Apache Ignite thin client to connect to the
+Apache Ignite cluster and perform data caching.
-Only two simple steps are required to plug in an Ignite cache into your
Spring-based application:
+== Maven Configuration
-* Start an Ignite node with proper configuration in embedded mode (i.e., in
the same JVM where the application is running). It can already have predefined
caches, but it's not required - caches will be created automatically on first
access if needed.
+If you use Maven to manage dependencies in your project, you can add Apache
Ignite Spring Cache extension
+dependencies to the application's `pom.xml` file like this:
+
+[NOTE]
+====
+For Apache Ignite 2.10.0 and earlier the `ignite-spring-cache-ext` dependency
must be added to
+classpath before `ignite-spring`, due to duplication of Spring Cache
integration classes. If you use Maven
+to manage dependencies, place `ignite-spring-cache-ext` before the
`ignite-spring` dependency in the
+application's `pom.xml` file.
+====
+
+[tabs]
+--
+tab:pom.xml[]
+[source,xml]
+----
+<dependency>
+ <groupId>org.apache.ignite</groupId>
+ <artifactId>ignite-spring-cache-ext</artifactId>
+ <version>${ignite-spring-cache-ext.version}</version>
+</dependency>
+
+<dependency>
+ <groupId>org.apache.ignite</groupId>
+ <artifactId>ignite-core</artifactId>
+ <version>${ignite.version}</version>
+</dependency>
+
+<!-- Note, that 'ignite-spring' depends on version of Spring dependencies,
that may conflict with version of Spring
+ dependencies used in your project. It is safe to exclude Spring
dependencies from 'ignite-spring' and add them
+ with version updated to match the Spring version used in your project.
+
+ For Apache Ignite 2.11.0 and earlier the following list of Spring
dependencies must be excluded to
+ avoid possible Spring version conflicts:
+ - 'spring-core'
+ - 'spring-aop'
+ - 'spring-context'
+ - 'spring-expressions'
+ - 'spring-beans'
+ - 'spring-jdbc'
+ - 'spring-tx'
+ -->
+<dependency>
+ <groupId>org.apache.ignite</groupId>
+ <artifactId>ignite-spring</artifactId>
+ <version>${ignite.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-context</artifactId>
+ </exclusion>
+ </exclusions>
+</dependency>
+
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-context</artifactId>
+ <version>${spring.version}</version>
+</dependency>
+----
+--
+
+Replace `${ignite-spring-cache-ext.version}`, `${spring.version}`, and
+`${ignite.version}` with an actual version of Apache Ignite Spring Cache
extension, Spring, and
+Apache Ignite dependency you need, respectively.
+
+The table below shows available versions of the Apache Ignite Spring Cache
extension and compatible versions
+of the Apache Ignite and Spring.
+
+[cols="4,5,5", opts="header"]
+|===
+|Apache Ignite Spring Cache extension version | Apache Ignite versions |
Spring versions
+| 1.0.0 | All versions since 2.11.0 | All versions since 4.3.0
+|===
+
+== Apache Ignite Node Cache Manager Configuration
+
+=== Cluster Connection Configuration
+
+To plug in an Ignite cache into your Spring-based application that uses Ignite
node to connect to Apache Ignite cluster
+you need to perform just two simple steps:
+
+* Start an Ignite node with proper configuration in embedded mode (i.e., in
the same JVM where the application is running).
+It can already have predefined caches, but it's not required - caches will be
created automatically on first access if required.
* Configure `SpringCacheManager` as the cache manager in the Spring
application context.
The embedded node can be started by `SpringCacheManager` itself. In this case
you will need to provide a path to either
-the Ignite configuration XML file or `IgniteConfiguration` bean via
`configurationPath` or `configuration`
+the Ignite configuration XML file or `IgniteConfiguration` instance via
`configurationPath` or `configuration`
properties respectively (see examples below). Note that setting both is
illegal and results in `IllegalArgumentException`.
+[discrete]
+=== Specifying Apache Ignite Node Configuration
+
[tabs]
--
-tab:configuration path[]
+tab:Java[]
+[source,java]
+----
+@Configuration
+@EnableCaching
+public class SpringApplicationConfiguration {
+ @Bean
+ public SpringCacheManager cacheManager() {
+ SpringCacheManager mgr = new SpringCacheManager();
+
+ mgr.setConfiguration(new IgniteConfiguration()
+ .setIgniteInstanceName("<name of the Ignite node instance>"));
+ // Other required configuration parameters.
+
+ return mgr;
+ }
+}
+----
+tab:XML[]
[source,xml]
----
<beans xmlns="http://www.springframework.org/schema/beans"
@@ -45,16 +153,43 @@ tab:configuration path[]
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/cache
http://www.springframework.org/schema/cache/spring-cache.xsd">
- <!-- Provide configuration file path. -->
+ <!-- Provide configuration bean. -->
<bean id="cacheManager"
class="org.apache.ignite.cache.spring.SpringCacheManager">
- <property name="configurationPath"
value="examples/config/spring-cache.xml"/>
+ <property name="configuration">
+ <bean class="org.apache.ignite.configuration.IgniteConfiguration">
+ ...
+ </bean>
+ </property>
</bean>
<!-- Enable annotation-driven caching. -->
<cache:annotation-driven/>
</beans>
----
-tab:configuration bean[]
+--
+
+[discrete]
+=== Specifying Path to Apache Ignite XML Node Configuration File
+
+[tabs]
+--
+tab:Java[]
+[source,java]
+----
+@Configuration
+@EnableCaching
+public class SpringApplicationConfiguration {
+ @Bean
+ public SpringCacheManager cacheManager() {
+ SpringCacheManager mgr = new SpringCacheManager();
+
+ mgr.setConfigurationPath("<path to an Apache Ignite configuration XML
file (path can be absolute or relative to `IGNITE_HOME`)");
+
+ return mgr;
+ }
+}
+----
+tab:XML[]
[source,xml]
----
<beans xmlns="http://www.springframework.org/schema/beans"
@@ -65,30 +200,44 @@ tab:configuration bean[]
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/cache
http://www.springframework.org/schema/cache/spring-cache.xsd">
- <-- Provide configuration bean. -->
+ <!-- Provide configuration file path. -->
<bean id="cacheManager"
class="org.apache.ignite.cache.spring.SpringCacheManager">
- <property name="configuration">
- <bean class="org.apache.ignite.configuration.IgniteConfiguration">
- ...
- </bean>
- </property>
+ <property name="configurationPath" value="<path to an Apache Ignite
configuration XML file (path can be absolute or relative to `IGNITE_HOME`)"/>
</bean>
- <-- Enable annotation-driven caching. -->
+ <!-- Enable annotation-driven caching. -->
<cache:annotation-driven/>
</beans>
----
-
--
+[discrete]
+=== Specifying Name of the Manually Started Apache Ignite Node Instance
+
It's possible that you already have an Ignite node running when the cache
manager is initialized (e.g., it was started using
-`ServletContextListenerStartup`). In this case you should simply provide the
grid name via `gridName` property.
+`ServletContextListenerStartup`). In this case you should simply provide the
grid name via `igniteInstanceName` property.
Note that if you don't set the grid name as well, the cache manager will try
to use the default Ignite instance
(the one with the `null` name). Here is an example:
[tabs]
--
-tab:Using an already started Ignite instance[]
+tab:Java[]
+[source,java]
+----
+@Configuration
+@EnableCaching
+public class SpringApplicationConfiguration {
+ @Bean
+ public SpringCacheManager cacheManager() {
+ SpringCacheManager mgr = new SpringCacheManager();
+
+ mgr.setIgniteInstanceName("<name of the Apache Ignite node instance>");
+
+ return mgr;
+ }
+}
+----
+tab:XML[]
[source,xml]
----
<beans xmlns="http://www.springframework.org/schema/beans"
@@ -101,7 +250,7 @@ tab:Using an already started Ignite instance[]
http://www.springframework.org/schema/cache/spring-cache.xsd">
<!-- Provide grid name. -->
<bean id="cacheManager"
class="org.apache.ignite.cache.spring.SpringCacheManager">
- <property name="gridName" value="myGrid"/>
+ <property name="igniteInstanceName" value="<name of the Apache Ignite
node instance>"/>
</bean>
<!-- Enable annotation-driven caching. -->
@@ -117,18 +266,36 @@ Keep in mind that the node started inside your
application is an entry point to
You can start as many remote standalone nodes as you need and all these nodes
will participate in caching the data.
====
-== Dynamic Caches
+=== Dynamic Caches
While you can have all required caches predefined in Ignite configuration,
it's not required. If Spring wants to use a
cache that doesn't exist, the `SpringCacheManager` will automatically create
it.
-If otherwise not specified, a new cache will be created will all defaults. To
customize it, you can provide a configuration
+If otherwise not specified, a new cache will be created with default
configuration. To customize it, you can provide a configuration
template via `dynamicCacheConfiguration` property. For example, if you want to
use `REPLICATED` caches instead of
`PARTITIONED`, you should configure `SpringCacheManager` like this:
[tabs]
--
-tab:Dynamic cache configuration[]
+tab:Java[]
+[source,java]
+----
+@Configuration
+@EnableCaching
+public class SpringApplicationConfiguration {
+ @Bean
+ public SpringCacheManager cacheManager() {
+ SpringCacheManager mgr = new SpringCacheManager();
+ ...
+
+ mgr.setDynamicCacheConfiguration(new CacheConfiguration<>("<cache
name>")
+ .setCacheMode(CacheMode.REPLICATED));
+
+ return mgr;
+ }
+}
+----
+tab:XML[]
[source,xml]
----
<bean id="cacheManager"
class="org.apache.ignite.cache.spring.SpringCacheManager">
@@ -136,6 +303,7 @@ tab:Dynamic cache configuration[]
<property name="dynamicCacheConfiguration">
<bean class="org.apache.ignite.configuration.CacheConfiguration">
+ <property name="name" value="<cache name>"/>
<property name="cacheMode" value="REPLICATED"/>
</bean>
</property>
@@ -148,7 +316,24 @@ You can also utilize near caches on client side. To
achieve this, simply provide
[tabs]
--
-tab:Dynamic near cache configuration[]
+tab:Java[]
+[source,java]
+----
+@Configuration
+@EnableCaching
+public class SpringApplicationConfiguration {
+ @Bean
+ public SpringCacheManager cacheManager() {
+ SpringCacheManager mgr = new SpringCacheManager();
+ ...
+
+ mgr.setDynamicNearCacheConfiguration(new
NearCacheConfiguration<>().setNearStartSize(1000));
+
+ return mgr;
+ }
+}
+----
+tab:XML[]
[source,xml]
----
<bean id="cacheManager"
class="org.apache.ignite.cache.spring.SpringCacheManager">
@@ -163,6 +348,149 @@ tab:Dynamic near cache configuration[]
----
--
+== Apache Ignite Thin Client Cache Manager Configuration
+This chapter shows how to set up `IgniteClientSpringCacheManager` that relies
on Ignite thin client to connect
+to the Ignite cluster and perform caching.
+
+[IMPORTANT]
+====
+[discrete]
+`IgniteClientSpringCacheManager` does not support Spring Cache synchronous mode
+(https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/cache/annotation/Cacheable.html#sync--[Cacheable#sync,
window=_blank]).
+If this feature is crucial to your application, choose the
+link:extensions-and-integrations/spring/spring-caching#apache-ignite-node-cache-manager-configuration[SpringCacheManager]
+that uses an Ignite node to connect to Ignite cluster.
+====
+
+=== Cluster Connection Configuration
+Cluster connection configuration defines Apache Ignite thin client used by
`IgniteClientSpringCacheManager` to access
+the cluster.
+There are several approaches to do this:
+
+[NOTE]
+====
+It is incorrect to mix multiple approaches - this results in the
`IllegalArgumentException` exception during the manager startup.
+====
+
+[discrete]
+=== Specifying Instance of the Apache Ignite Thin Client
+
+[tabs]
+--
+tab:Java[]
+[source,java]
+----
+@Configuration
+@EnableCaching
+public class SpringApplicationConfiguration {
+ @Bean
+ public IgniteClient igniteClient() {
+ return Ignition.startClient(new
ClientConfiguration().setAddresses("127.0.0.1:10800"));
+ }
+
+ @Bean
+ public IgniteClientSpringCacheManager cacheManager(IgniteClient cli) {
+ return new IgniteClientSpringCacheManager().setClientInstance(cli);
+ }
+}
+----
+tab:XML[]
+[source,xml]
+----
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:cache="http://www.springframework.org/schema/cache"
+ xsi:schemaLocation="
+ http://www.springframework.org/schema/beans
+ http://www.springframework.org/schema/beans/spring-beans.xsd
+ http://www.springframework.org/schema/cache
+ http://www.springframework.org/schema/cache/spring-cache.xsd">
+ <!--
+ Note that org.apache.ignite.IgniteClientSpringBean is available since
Apache Ignite 2.11.0 version.
+ For Apache Ignite 2.10.0 and earlier
`org.apache.ignite.client.IgniteClient` bean should be created
+ manually with concern of its connection to the Ignite cluster.
+ -->
+ <bean id="igniteClient" class="org.apache.ignite.IgniteClientSpringBean">
+ <property name="clientConfiguration">
+ <bean class="org.apache.ignite.configuration.ClientConfiguration">
+ <property name="addresses">
+ <list>
+ <value>127.0.0.1:10800</value>
+ </list>
+ </property>
+ </bean>
+ </property>
+ </bean>
+
+ <!-- Provide Apache Ignite thin client instance. -->
+ <bean id="cacheManager"
class="org.apache.ignite.cache.spring.IgniteClientSpringCacheManager">
+ <property name="clientInstance" ref="igniteClient"/>
+ </bean>
+
+ <!-- Use annotation-driven cache configuration. -->
+ <cache:annotation-driven/>
+</beans>
+----
+--
+
+[discrete]
+=== Specifying Apache Ignite Thin Client Configuration
+
+In this case, Apache Ignite thin client instance is started automatically by
the `IgniteClientSpringCacheManager` based
+on the provided configuration.
+
+[tabs]
+--
+tab:Java[]
+[source,java]
+----
+@Configuration
+@EnableCaching
+public class SpringApplicationConfiguration {
+ @Bean
+ public IgniteClientSpringCacheManager cacheManager() {
+ return new IgniteClientSpringCacheManager()
+ .setClientConfiguration(new ClientConfiguration()
+ .setAddresses("127.0.0.1:10800"));
+ }
+}
+----
+tab:XML[]
+[source,xml]
+----
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:cache="http://www.springframework.org/schema/cache"
+ xsi:schemaLocation="
+ http://www.springframework.org/schema/beans
+ http://www.springframework.org/schema/beans/spring-beans.xsd
+ http://www.springframework.org/schema/cache
+ http://www.springframework.org/schema/cache/spring-cache.xsd">
+ <!-- Provide configuration bean. -->
+ <bean id="cacheManager"
class="org.apache.ignite.cache.spring.IgniteClientSpringCacheManager">
+ <property name="clientConfiguration">
+ <bean class="org.apache.ignite.configuration.ClientConfiguration">
+ <property name="addresses">
+ <list>
+ <value>127.0.0.1:10800</value>
+ </list>
+ </property>
+ </bean>
+ </property>
+ </bean>
+
+ <!-- Use annotation-driven cache configuration. -->
+ <cache:annotation-driven/>
+</beans>
+----
+--
+
+=== Dynamic Caches
+
+Dynamic Caches configuration for `IgniteClientSpringCacheManager` is performed
the same way as for
+link:extensions-and-integrations/spring/spring-caching#dynamic-caches[SpringCacheManager]
+that uses Apache Ignite node instance to access the cluster.
+
== Example
Once you have added `SpringCacheManager` to your Spring application context,
you can enable caching for any Java method by simply attaching an annotation to
it.
diff --git a/docs/_docs/extensions-and-integrations/spring/spring-tx.adoc
b/docs/_docs/extensions-and-integrations/spring/spring-tx.adoc
index c33a33f..af9ec08 100644
--- a/docs/_docs/extensions-and-integrations/spring/spring-tx.adoc
+++ b/docs/_docs/extensions-and-integrations/spring/spring-tx.adoc
@@ -22,10 +22,10 @@ transaction life-cycle.
Apache Ignite provides the `ignite-spring-tx-ext` extension that allows to
manage
https://ignite.apache.org/docs/latest/key-value-api/transactions#performing-transactions[Apache
Ignite Transactions, window="_blank"]
-through the Spring Transactions abstraction. The mentioned integration is
achieved by providing implementations of the
+through the Spring Transactions abstraction. The mentioned above integration
is achieved by providing implementations of the
`TransactionManager` Spring Transactions interface. There are two such
implementations: `SpringTransactionManager` and
-`IgniteClientSpringTransactionManager`, which use Apache Ignite node or Apache
Ignite thin client to connect to the
-Apache Ignite cluster and manage the Apache Ignite transactions, respectively.
+`IgniteClientSpringTransactionManager`, which use either Apache Ignite node or
Apache Ignite thin client to connect to the
+Apache Ignite cluster and manage the Apache Ignite transactions.
To enable declarative transaction management in your Spring application,
create and configure
`SpringTransactionManager` or `IgniteClientSpringTransactionManager` bean in
the Spring application context. The choice
@@ -33,13 +33,13 @@ of implementation depends on your preferable way to access
the Apache Ignite clu
== Maven Configuration
-If you are using Maven to manage dependencies in your project, you can add
Spring Transactions extension dependencies to
+If you use Maven to manage dependencies in your project, you can add Spring
Transactions extension dependencies to
the application's `pom.xml` file like this:
[NOTE]
====
-For Apache Ignite versions earlier than `2.11.0`, the `ignite-spring-tx-ext`
dependency must be added to
-classpath before `ignite-spring`, due to duplication of Spring Transactions
integration classes. If you are using Maven
+For Apache Ignite 2.10.0 and earlier the `ignite-spring-tx-ext` dependency
must be added to
+classpath before `ignite-spring`, due to duplication of Spring Transactions
integration classes. If you use Maven
to manage dependencies, place `ignite-spring-tx-ext` before the
`ignite-spring` dependency in the
application's `pom.xml` file.
====
@@ -57,14 +57,40 @@ tab:pom.xml[]
<dependency>
<groupId>org.apache.ignite</groupId>
- <artifactId>ignite-spring</artifactId>
+ <artifactId>ignite-core</artifactId>
<version>${ignite.version}</version>
</dependency>
+<!-- Note, that 'ignite-spring' depends on version of Spring dependencies,
that may conflict with version of Spring
+ dependencies used in your project. It is safe to exclude Spring
dependencies from 'ignite-spring' and add them
+ with version updated to match the Spring version used in your project.
+
+ For Apache Ignite 2.11.0 and earlier the following list of Spring
dependencies must be excluded to
+ avoid possible Spring versions conflicts:
+ - 'spring-core'
+ - 'spring-aop'
+ - 'spring-context'
+ - 'spring-expressions'
+ - 'spring-beans'
+ - 'spring-jdbc'
+ - 'spring-tx'
+ -->
<dependency>
<groupId>org.apache.ignite</groupId>
- <artifactId>ignite-core</artifactId>
+ <artifactId>ignite-spring</artifactId>
<version>${ignite.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-context</artifactId>
+ </exclusion>
+ </exclusions>
+</dependency>
+
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-context</artifactId>
+ <version>${spring.version}</version>
</dependency>
<dependency>
@@ -76,16 +102,16 @@ tab:pom.xml[]
--
Replace `${ignite-spring-tx-ext.version}`, `${spring.version}`, and
-`${ignite.version}` with an actual version of Apache Ignite Spring
Transactions extension, Spring Transactions, and
-Apache Ignite dependency you are interested in, respectively.
+`${ignite.version}` with an actual version of Apache Ignite Spring
Transactions extension, Spring, and
+Apache Ignite dependency you need, respectively.
-The table below shows available versions of the Apache Ignite Spring
Transactions extension and corresponding versions
-of the Apache Ignite each one is compatible with.
+The table below shows available versions of the Apache Ignite Spring
Transactions extension and compatible versions
+of the Apache Ignite and Spring.
-[cols="4,5", opts="header"]
+[cols="4,5,5", opts="header"]
|===
-|Apache Ignite Spring Transactions extension version | Compatible Apache
Ignite versions
-| 1.0.0 | All versions since 2.8.0
+|Apache Ignite Spring Transactions extension version | Apache Ignite versions
| Spring versions
+| 1.0.0 | All versions since 2.11.0 | All versions since 4.3.0
|===
== Apache Ignite Node Transaction Manager Configuration
@@ -96,8 +122,8 @@ and
link:extensions-and-integrations/spring/spring-tx#transaction-concurrency-mo
=== Cluster Connection Configuration
-Cluster connection configuration defines Apache Ignite node that
`SpringTransactionManager` uses to access the cluster.
-To do this, you can use the following approaches.
+Cluster connection configuration defines Apache Ignite node used by
`SpringTransactionManager` to access the cluster.
+There are several approaches to do this:
[NOTE]
====
@@ -136,14 +162,14 @@ tab:XML[]
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx.xsd">
- <-- Provide Apache Ignite instance name. -->
+ <!-- Provide Apache Ignite instance name. -->
<bean id="transactionManager"
class="org.apache.ignite.transactions.spring.SpringTransactionManager">
<property
name="igniteInstanceName"
value="<name of the Apache Ignite node instance>"/>
</bean>
- <-- Use annotation-driven transaction configuration. -->
+ <!-- Use annotation-driven transaction configuration. -->
<tx:annotation-driven/>
</beans>
----
@@ -184,7 +210,7 @@ tab:XML[]
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx.xsd">
- <-- Provide configuration bean. -->
+ <!-- Provide configuration bean. -->
<bean id="transactionManager"
class="org.apache.ignite.transactions.spring.SpringTransactionManager">
<property name="configuration">
<bean id="gridCfg"
class="org.apache.ignite.configuration.IgniteConfiguration">
@@ -193,7 +219,7 @@ tab:XML[]
</property>
</bean>
- <-- Use annotation-driven transaction configuration. -->
+ <!-- Use annotation-driven transaction configuration. -->
<tx:annotation-driven/>
</beans>
----
@@ -231,14 +257,14 @@ tab:XML[]
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx.xsd">
- <-- Provide configuration file path. -->
+ <!-- Provide configuration file path. -->
<bean id="transactionManager"
class="org.apache.ignite.transactions.spring.SpringTransactionManager">
<property
name="configurationPath"
value="<path to an Apache Ignite configuration XML file (path can
be absolute or relative to `IGNITE_HOME`)"/>
</bean>
- <-- Use annotation-driven transaction configuration. -->
+ <!-- Use annotation-driven transaction configuration. -->
<tx:annotation-driven/>
</beans>
----
@@ -293,13 +319,13 @@ tab:XML[]
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx.xsd">
- <-- Provide Apache Ignite instance name. -->
+ <!-- Provide Apache Ignite instance name. -->
<bean id="transactionManager"
class="org.apache.ignite.transactions.spring.SpringTransactionManager">
<!-- Here is appropriate connection configuration. -->
<property name="transactionConcurrency" value="OPTIMISTIC"/>
</bean>
- <-- Use annotation-driven transaction configuration. -->
+ <!-- Use annotation-driven transaction configuration. -->
<tx:annotation-driven/>
</beans>
----
@@ -360,7 +386,7 @@ tab:XML[]
<property name="transactionConcurrency" value="PESSIMISTIC"/>
</bean>
- <-- Use annotation-driven transaction configuration. -->
+ <!-- Use annotation-driven transaction configuration. -->
<tx:annotation-driven/>
</beans>
----
@@ -386,8 +412,8 @@ This chapter shows how to set up
`IgniteClientSpringTransactionManager` that rel
to the cluster and manage transactions.
=== Cluster Connection Configuration
-Cluster connection configuration defines Apache Ignite thin client instance
that `IgniteClientSpringTransactionManager`
-uses to access the cluster.
+Cluster connection configuration defines Apache Ignite thin client instance
used by `IgniteClientSpringTransactionManager`
+to access the cluster.
[tabs]
--
@@ -399,7 +425,7 @@ tab:Java[]
public static class SpringApplicationConfiguration {
@Bean
public IgniteClient igniteClient() {
- return Ignition.startClient(new
ClientConfiguration().setAddresses("127.0.0.1:10800));
+ return Ignition.startClient(new
ClientConfiguration().setAddresses("127.0.0.1:10800"));
}
@Bean
@@ -423,7 +449,7 @@ tab:XML[]
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx.xsd">
<!--
Note that org.apache.ignite.IgniteClientSpringBean is available since
Apache Ignite 2.11.0 version.
- For Apache Ignite versions earlier than 2.11.0
org.apache.ignite.client.IgniteClient bean should be created
+ For Apache Ignite 2.10.0 and earlier
`org.apache.ignite.client.IgniteClient` bean should be created
manually with concern of its connection to the Ignite cluster.
-->
<bean id="igniteClient" class="org.apache.ignite.IgniteClientSpringBean">
@@ -438,12 +464,12 @@ tab:XML[]
</property>
</bean>
- <-- Provide Apache Ignite client instance. -->
+ <!-- Provide Apache Ignite client instance. -->
<bean id="transactionManager"
class="org.apache.ignite.transactions.spring.IgniteClientSpringTransactionManager">
<property name="clientInstance" ref="igniteClientBean"/>
</bean>
- <-- Use annotation-driven transaction configuration. -->
+ <!-- Use annotation-driven transaction configuration. -->
<tx:annotation-driven/>
</beans>
----