Annotation Interface EnableHazelcastHttpSession


@Retention(RUNTIME) @Target(TYPE) @Documented @Import(HazelcastHttpSessionConfiguration.class) public @interface EnableHazelcastHttpSession
Add this annotation to an @Configuration class to expose the SessionRepositoryFilter as a bean named springSessionRepositoryFilter and backed by Hazelcast. In order to leverage the annotation, a single HazelcastInstance must be provided. For example:
 @Configuration(proxyBeanMethods = false)
 @EnableHazelcastHttpSession
 public class HazelcastHttpSessionConfig {

     @Bean
     public HazelcastInstance embeddedHazelcast() {
         Config hazelcastConfig = new Config();
         return Hazelcast.newHazelcastInstance(hazelcastConfig);
     }

 }
 
More advanced configurations can extend HazelcastHttpSessionConfiguration instead.
Since:
1.1
See Also:
  • Element Details

    • maxInactiveIntervalInSeconds

      int maxInactiveIntervalInSeconds
      The session timeout in seconds. By default, it is set to 1800 seconds (30 minutes). This should be a non-negative integer.
      Returns:
      the seconds a session can be inactive before expiring
      Default:
      1800
    • sessionMapName

      String sessionMapName
      This is the name of the Map that will be used in Hazelcast to store the session data. Default is "spring:session:sessions".
      Returns:
      the name of the Map to store the sessions in Hazelcast
      Default:
      "spring:session:sessions"
    • flushMode

      FlushMode flushMode
      Flush mode for the Hazelcast sessions. The default is ON_SAVE which only updates the backing Hazelcast when SessionRepository.save(Session) is invoked. In a web environment this happens just before the HTTP response is committed.

      Setting the value to IMMEDIATE will ensure that the any updates to the Session are immediately written to the Hazelcast instance.

      Returns:
      the FlushMode to use
      Since:
      2.2.0
      Default:
      ON_SAVE
    • saveMode

      SaveMode saveMode
      Save mode for the session. The default is SaveMode.ON_SET_ATTRIBUTE, which only saves changes made to session.
      Returns:
      the save mode
      Since:
      2.2.0
      Default:
      ON_SET_ATTRIBUTE