Skip to content

Commit 8a5aa31

Browse files
Document breaking changes and address user's feedback [v/5.6] (#2108)
Backport of #2106 Co-authored-by: Tomasz Gawęda <tomasz.gaweda@outlook.com>
1 parent 173b02c commit 8a5aa31

File tree

3 files changed

+25
-8
lines changed

3 files changed

+25
-8
lines changed

docs/modules/spring/pages/hazelcast-spring-session.adoc

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,13 @@ dependencies {
5151

5252
TIP: Hazelcast Spring Session uses the same major version number as Spring Boot it was created for. For Spring Boot 4.x, the compatible Hazelcast Spring Session will be always 4.x.
5353

54-
=== Migrate from Spring Session Hazelcast 3.x
54+
== Migrate from Spring Session Hazelcast 3.x
5555

5656
From version 4.0, the Hazelcast integration with Spring Session is owned by the Hazelcast team.
5757

5858
To migrate your application from using Spring Session Hazelcast 3.x to the new Hazelcast Spring Session 4.x:
5959

60-
. Change the GroupId to `com.hazelcast` and artifactId to `hazelcast-spring-session`.
60+
. Change the GroupId to `com.hazelcast.spring` and artifactId to `hazelcast-spring-session`.
6161
. Update your code and change the packages. All Hazelcast-specific classes were moved from `org.springframework.session.hazelcast` to `com.hazelcast.spring.session`.
6262
. Remove this configuration for `PrincipalNameExtractor`:
6363
+
@@ -74,17 +74,33 @@ config.getMapConfig(SESSIONS_MAP_NAME)
7474
[source,java]
7575
----
7676
SerializerConfig serializerConfig = new SerializerConfig();
77-
serializerConfig.setImplementation(new HazelcastSessionSerializer()).setTypeClass(MapSession.class);
78-
config.getSerializationConfig().addSerializerConfig(serializerConfig);
77+
serializerConfig.setImplementation(new HazelcastSessionSerializer()).setTypeClass(MapSession.class);
78+
config.getSerializationConfig().addSerializerConfig(serializerConfig);
7979
----
8080
With a call:
8181
+
8282
[source,java]
8383
----
8484
config = HazelcastSessionConfiguration.applySerializationConfig(config);
8585
----
86-
. Index configuration for `PRINCIPAL_ATTRIBUTE_NAME` **if** no other IMap customization is wanted.
87-
86+
+
87+
Note that this call should be made before instance creation (before the call to `Hazelcast.newHazelcastInstance`).
88+
. Remove index configuration for `PRINCIPAL_ATTRIBUTE_NAME` **if** no other IMap customization is wanted; it will be configured automatically. If you want to further customize the session IMap, you can either:
89+
- create `MapConfig` manually and then create an index of type `HASH` on the `principalName` attribute.
90+
- create a bean of type `SessionMapCustomizer` to apply your customizations on predefined `MapConfig`.
91+
92+
=== List of breaking changes
93+
94+
Spring Session 4.0.0 is a major release. It contains the following breaking changes:
95+
96+
- Group ID and artifact ID are changed to `com.hazelcast.spring` / `hazelcast-spring-session`.
97+
- The main package name is changed from `org.springframework.session.hazelcast` to `com.hazelcast.spring.session`.
98+
- Serialization is reworked. It no longer uses an optional `HazelcastSessionSerializer`, but relies on Compact Serialization with two new serializers: `com.hazelcast.spring.session.AttributeValueCompactSerializer` and `com.hazelcast.spring.session.HazelcastSessionCompactSerializer`. Additionally, a `SessionUpdateEntryProcessor` serializer will be configured automatically on server nodes if a JAR is deployed on server nodes.
99+
- The binary representation of the data is changed. Instead of using Spring's `MapSession`, it uses `com.hazelcast.spring.session.BackingMapSession` with attributes stored as `com.hazelcast.spring.session.AttributeValue`. This change enables true client-server deployments without the need for any custom code deployment on server nodes for classes used as session attributes.
100+
- Method `void setDefaultMaxInactiveInterval(Integer defaultMaxInactiveInterval)` in `HazelcastIndexedSessionRepository` is removed. Use an alternative with `Duration` as a parameter.
101+
- Most of the setter methods in `HazelcastIndexedSessionRepository` now return `HazelcastIndexedSessionRepository` (`this`) for fluent API.
102+
- The default logging framework is changed to SLF4J; the default annotations library is now JSpecify.
103+
- Spring Session now fully supports Java Modules.
88104

89105
== Supported topologies
90106

-16.7 MB
Binary file not shown.

docs/modules/spring/pages/spring-session-guide.adoc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,11 +100,12 @@ This section describes how to work with the Hazelcast Spring Security sample app
100100

101101
=== Running the Sample Application
102102

103-
You can run the sample by obtaining the link:https://docs.hazelcast.com/hazelcast/latest/spring/spring-session-3.5.2.zip[source code] and invoking the following command:
103+
You can run the sample by obtaining the link:https://github.com/hazelcast/hazelcast-code-samples/tree/master/spring/spring-session-servlet[source code] and invoking the following command:
104104

105105
[source,shell]
106106
----
107-
$ ./gradlew :spring-session-sample-javaconfig-hazelcast:tomcatRun
107+
$ cd spring/spring-session-servlet
108+
$ mvn jetty:run
108109
----
109110

110111
NOTE: By default, Hazelcast runs in embedded mode with your application.

0 commit comments

Comments
 (0)