Annotation Interface EnableHazelcastHttpSession
@Retention(RUNTIME)
@Target(TYPE)
@Documented
@Import(HazelcastHttpSessionConfiguration.class)
@Configuration(proxyBeanMethods=false)
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
@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:
-
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionFlush mode for the Hazelcast sessions.Deprecated.intThe session timeout in seconds.Save mode for the session.This is the name of the Map that will be used in Hazelcast to store the session data.
-
Element Details
-
maxInactiveIntervalInSeconds
int maxInactiveIntervalInSecondsThe 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 sessionMapNameThis 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"
-
hazelcastFlushMode
Deprecated.since 2.2.0 in favor offlushMode()Flush mode for the Hazelcast sessions. The default isON_SAVEwhich only updates the backing Hazelcast whenSessionRepository.save(Session)is invoked. In a web environment this happens just before the HTTP response is committed.Setting the value to
IMMEDIATEwill ensure that the any updates to the Session are immediately written to the Hazelcast instance.- Returns:
- the
HazelcastFlushModeto use - Since:
- 1.3.0
- Default:
- ON_SAVE
-
flushMode
FlushMode flushModeFlush mode for the Hazelcast sessions. The default isON_SAVEwhich only updates the backing Hazelcast whenSessionRepository.save(Session)is invoked. In a web environment this happens just before the HTTP response is committed.Setting the value to
IMMEDIATEwill ensure that the any updates to the Session are immediately written to the Hazelcast instance.- Returns:
- the
FlushModeto use - Since:
- 2.2.0
- Default:
- ON_SAVE
-
saveMode
SaveMode saveModeSave mode for the session. The default isSaveMode.ON_SET_ATTRIBUTE, which only saves changes made to session.- Returns:
- the save mode
- Since:
- 2.2.0
- Default:
- ON_SET_ATTRIBUTE
-
flushMode()