diff --git a/docs/modules/ROOT/nav.adoc b/docs/modules/ROOT/nav.adoc index 7d20ee429..5b48b88e9 100644 --- a/docs/modules/ROOT/nav.adoc +++ b/docs/modules/ROOT/nav.adoc @@ -528,8 +528,8 @@ ** xref:spring:springaware.adoc[] ** xref:spring:add-caching.adoc[] ** xref:spring:hibernate.adoc[] +** xref:spring:session-replication.adoc[] ** xref:spring:transaction-manager.adoc[] -** xref:spring:best-practices.adoc[] // Feast * xref:integrate:integrate-with-feast.adoc[] ** xref:integrate:install-connect.adoc[Install and connect Feast] diff --git a/docs/modules/spring/pages/add-caching.adoc b/docs/modules/spring/pages/add-caching.adoc index 8265367d8..69a30a4b0 100644 --- a/docs/modules/spring/pages/add-caching.adoc +++ b/docs/modules/spring/pages/add-caching.adoc @@ -1,4 +1,4 @@ -= Adding Caching to Spring += Add caching to Spring As of version 3.1, Spring Framework provides support for adding caching into an existing Spring application. Spring 3.2 and later versions support diff --git a/docs/modules/spring/pages/best-practices.adoc b/docs/modules/spring/pages/best-practices.adoc deleted file mode 100644 index 01578c191..000000000 --- a/docs/modules/spring/pages/best-practices.adoc +++ /dev/null @@ -1,50 +0,0 @@ -= Spring Best Practices - -Spring tries to create a new `Map`/`Collection` instance and fill -the new instance by iterating and converting values of the original -`Map`/`Collection` (`IMap`, `IQueue`, etc.) to required types when generic -type parameters of the original `Map`/`Collection` and the target property/attribute do not match. - -Since Hazelcast ``Map``s/``Collection``s are designed to hold very large -data which a single machine cannot carry, iterating through whole values can cause out of memory errors. - -To avoid this issue, the target property/attribute can be declared as -un-typed `Map`/`Collection` as shown below. - -[source,java] ----- -public class SomeBean { - @Autowired - IMap map; // instead of IMap map - - @Autowired - IQueue queue; // instead of IQueue queue - ... -} ----- - -Or, parameters of injection methods (constructor, setter) can be un-typed as shown below. - -[source,java] ----- -public class SomeBean { - - IMap map; - IQueue queue; - - // Instead of IMap map - public SomeBean(IMap map) { - this.map = map; - } - - ... - - // Instead of IQueue queue - public void setQueue(IQueue queue) { - this.queue = queue; - } - ... -} ----- - -NOTE: See https://jira.springsource.org/browse/SPR-3407[Spring issue-3407^] for more information. \ No newline at end of file diff --git a/docs/modules/spring/pages/configuration.adoc b/docs/modules/spring/pages/configuration.adoc index e09cc4821..6952bb915 100644 --- a/docs/modules/spring/pages/configuration.adoc +++ b/docs/modules/spring/pages/configuration.adoc @@ -1,4 +1,4 @@ -= Configuring Hazelcast in Spring += Configure Hazelcast in Spring *Code Sample*: See our https://github.com/hazelcast/hazelcast-code-samples/tree/master/spring/spring-configuration[sample application^] for Spring Configuration. diff --git a/docs/modules/spring/pages/hibernate.adoc b/docs/modules/spring/pages/hibernate.adoc index fd4c553a9..95496697c 100644 --- a/docs/modules/spring/pages/hibernate.adoc +++ b/docs/modules/spring/pages/hibernate.adoc @@ -1,7 +1,7 @@ -= Configuring Hibernate Second-Level Cache += Configure Hibernate second level cache **Code Sample**: See the https://github.com/hazelcast/hazelcast-code-samples/tree/master/spring/spring-hibernate-2ndlevel-cache[sample application^] -for Hibernate 2nd Level Cache configuration. +for Hibernate second level cache configuration. If you are using Hibernate with Hazelcast as a second level cache provider, you can easily configure your `LocalSessionFactoryBean` to use a Hazelcast instance by passing Hazelcast instance name. That way, you can use the diff --git a/docs/modules/spring/pages/overview.adoc b/docs/modules/spring/pages/overview.adoc index 296e14442..676c7f06d 100644 --- a/docs/modules/spring/pages/overview.adoc +++ b/docs/modules/spring/pages/overview.adoc @@ -1,7 +1,33 @@ = Integrate with Spring -You can integrate Hazelcast with Spring and this section explains the -configuration of Hazelcast within Spring context. +https://spring.io/[Spring] is a popular framework for writing enterprise-grade Java applications. https://spring.io/projects/spring-framework[Spring Framework] includes a range of libraries to reduce the need for boilerplate code and encourages a consistent structure for ease of maintenance. https://spring.io/projects/spring-boot[Spring Boot] further simplifies development by automatically configuring applications on your classpath. -Supported Versions are Spring 4.3 and higher releases and the latest -tested Spring version is 5.3. +Hazelcast Platform is integrated with the Spring Framework and Spring Boot, allowing you to easily incorporate Hazelcast's fast data cache capabilities into your Spring applications. + +== Why use Hazelcast with Spring? + +You can use Hazelcast to enhance your Spring applications with caching and session replication. + +* **Cache**: you can use Hazelcast as a Spring cache manager or a JCache-compliant cache, as described in the https://docs.spring.io/spring-boot/reference/io/caching.html#io.caching.provider.hazelcast[Spring Boot documentation]. + +* **Hibernate second-level cache**: you can use Hazelcast as a second-level cache in your https://hibernate.org/[Hibernate] `LocalSessionFactoryBean` configuration. + +* **Session replication**: you can use Hazelcast to replicate session data across multiple web applications or microservices. Hazelcast provides xref:plugins:web-session-replication.adoc[plugins] for several web servers, including Spring's default web server, Tomcat. + +Using Spring also makes it easier to work with Hazelcast. You can: + +* Autowire Hazelcast objects, such as the distributed map (IMap), without needing to configure a Hazelcast member first. Spring Boot automatically configures a Hazelcast member if Hazelcast is on the classpath. +* Use `@SpringAware` annotation on Hazelcast objects to enable dependency injection inside classes processed by Hazelcast, such as `EntryProcessor` and `Callable`. +* Reduce the configuration needed to set up Hazelcast. + +== Architecture options + +You can embed Hazelcast members in the same Java process as your Spring application or deploy them separately in a client/server topology. See xref:deploy:choosing-a-deployment-option.adoc[]. + +== Supported versions + +Hazelcast supports the following Spring Framework versions: + +* **Supported**: 5.3.39+ + +* **Latest tested**: 6.2.0 \ No newline at end of file diff --git a/docs/modules/spring/pages/session-replication.adoc b/docs/modules/spring/pages/session-replication.adoc new file mode 100644 index 000000000..d9ae505c0 --- /dev/null +++ b/docs/modules/spring/pages/session-replication.adoc @@ -0,0 +1,2 @@ += Enable session replication + diff --git a/docs/modules/spring/pages/springaware.adoc b/docs/modules/spring/pages/springaware.adoc index bdc793ac3..9beb88ed4 100644 --- a/docs/modules/spring/pages/springaware.adoc +++ b/docs/modules/spring/pages/springaware.adoc @@ -1,4 +1,4 @@ -= Enabling SpringAware Objects += Enable SpringAware objects You can mark Hazelcast Distributed Objects with `@SpringAware` if the object wants to apply: diff --git a/docs/modules/spring/pages/transaction-manager.adoc b/docs/modules/spring/pages/transaction-manager.adoc index 0c46e09fa..781f02b8f 100644 --- a/docs/modules/spring/pages/transaction-manager.adoc +++ b/docs/modules/spring/pages/transaction-manager.adoc @@ -1,4 +1,6 @@ -= Configuring Hazelcast Transaction Manager += Configure Hazelcast Transaction Manager + +WARNING: Hazelcast Transaction Manager is deprecated. It is no longer maintained and may be removed in a future release of Hazelcast Platform. You can get rid of the boilerplate code to begin, commit or rollback transactions by using https://docs.hazelcast.org/docs/{full-version}/javadoc/com/hazelcast/spring/transaction/HazelcastTransactionManager.html[HazelcastTransactionManager^]