To use Spring Session for Apache Geode for session state caching for apps with GemFire for VMs, follow these steps:

  1. In the app, replace the existing Spring Session @EnableXXXHttpSession annotation with:

    @EnableGemFireHttpSession(maxInactiveIntervalInSeconds = N)

    Where N is an integer representing seconds.

  2. In the app, add the spring-session-data-geode and spring-data-geode dependencies to the build.

  3. In the app, add beans to the Spring app configuration.

  4. On a command line, connected with a security role that can manage cluster data, use gfsh to create a region on the cluster servers named ClusteredSpringSessions:

    gfsh>create region --name=ClusteredSpringSessions --type=PARTITION_HEAP_LRU

Do not enable Tomcat session state caching as described in Enable Session State Caching in Tomcat Session State Caching. Mixing Tomcat session state caching with Spring Session caching can cause issues.

The Session State Code Example demonstrates session state caching.

For reference documentation, see Spring Session in the Spring documentation.

check-circle-line exclamation-circle-line close-line
Scroll to top icon