@Retention(value=RUNTIME) @Target(value=TYPE) @Documented @Import(value=HazelcastHttpSessionConfiguration.class) @Configuration(proxyBeanMethods=false) 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 |
|---|---|
org.springframework.session.FlushMode |
flushMode
Flush mode for the Hazelcast sessions.
|
HazelcastFlushMode |
hazelcastFlushMode
Deprecated.
since 2.2.0 in favor of
flushMode() |
int |
maxInactiveIntervalInSeconds
The session timeout in seconds.
|
org.springframework.session.SaveMode |
saveMode
Save mode for the session.
|
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
@Deprecated public abstract HazelcastFlushMode hazelcastFlushMode
flushMode()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 usepublic abstract org.springframework.session.FlushMode flushMode
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.
FlushMode to use