@Retention(value=RUNTIME) @Target(value=TYPE) @Documented @Import(value=HazelcastHttpSessionConfiguration.class) @Configuration public @interface EnableHazelcastHttpSession
@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.EnableSpringHttpSession| Modifier and Type | Optional Element and Description |
|---|---|
HazelcastFlushMode |
hazelcastFlushMode
Flush mode for the Hazelcast sessions.
|
int |
maxInactiveIntervalInSeconds
The session timeout in seconds.
|
java.lang.String |
sessionMapName
This is the name of the Map that will be used in Hazelcast to store the session
data.
|
public abstract int maxInactiveIntervalInSeconds
public abstract java.lang.String sessionMapName
HazelcastSessionRepository.DEFAULT_SESSION_MAP_NAME.public abstract HazelcastFlushMode hazelcastFlushMode
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.
HazelcastFlushMode to use