Tanzu GemFire on Cloud Foundry 2.1

Spring Session for VMware Tanzu GemFire Caching

Last Updated March 03, 2025

This topic explains how to use Spring Session for VMware GemFire for session state caching for apps with VMware Tanzu GemFire on Cloud Foundry.

To use Spring Session for VMware Tanzu GemFire for session state caching for apps with Tanzu GemFire on Cloud Foundry, 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. Follow the instructions in Getting Startedin the Spring Session for VMware GemFire product documentation to add the appropriate dependencies to your app.

  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.

For reference documentation, see the Spring Session for VMware GemFire product documentation.