Annotation Interface EnableGemFireHttpSession
@Target(TYPE)
@Retention(RUNTIME)
@Documented
@Configuration
@Import(GemFireHttpSessionConfiguration.class)
public @interface EnableGemFireHttpSession
Add this
annotation
to a Spring application defined @Configuration
Class
exposing the SessionRepositoryFilter
as a bean named springSessionRepositoryFilter
to back the HttpSession
with either Apache Geode or Pivotal GemFire.
In order to use this annotation
, a single Apache Geode / Pivotal GemFire ClientCache
or Peer Cache
instance must be provided.
The most common use case is to use Apache Geode or Pivotal GemFire's client/server topology, where your
Spring Session enabled application uses a ClientCache
to manage Session
state in a cluster
of dedicated Apache Geode or Pivotal GemFire servers.
For example:
@ClientCacheApplication(subscriptionEnabled = true)
@EnableGemFireHttpSession(poolName = "DEFAULT"
public class ClientCacheHttpSessionConfiguration {
}
Alternatively, though less common (and not recommended), you can use Spring Session with Apache Geode
or Pivotal GemFire in the embedded Peer Cache
scenario, where your Spring Session enabled application
is technically a peer in the Apache Geode or Pivotal GemFire cluster.
For example:
@PeerCacheApplication
@EnableGemFireHttpSession
public class PeerCacheHttpSessionConfiguration {
}
More advanced configurations can extend GemFireHttpSessionConfiguration
instead.- Since:
- 1.1.0
- See Also:
-
Annotation
Properties
HttpSession
Cache
Region
ClientCache
Pool
Configuration
Import
Environment
Session
EnableSpringHttpSession
GemFireHttpSessionConfiguration
SpringSessionGemFireConfigurer
SessionExpirationPolicy
SessionSerializer
-
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionorg.apache.geode.cache.client.ClientRegionShortcut
Defines theClientCache
Region
data management policy.boolean
Determines whether the configuration for Spring Session using Apache Geode or Pivotal GemFire should be exposed in the SpringEnvironment
asProperties
.String[]
Identifies theSession
attributes by name that will be indexed for query operations.int
Defines the maximum interval in seconds that aSession
can remain inactive before it expires.Specifies the name of the specificPool
used by theClientCache
Region
(i.e.org.apache.geode.cache.RegionShortcut
Defines theCache
Region
data management policy.Defines the name of the bean referring to theSessionExpirationPolicy
used to configure theSession
expiration logic and strategy.Defines the name of the bean referring to theSessionSerializer
used to serializeSession
state between client and server or to disk when persisting or overflowingSession
state.
-
Element Details
-
clientRegionShortcut
org.apache.geode.cache.client.ClientRegionShortcut clientRegionShortcutDefines theClientCache
Region
data management policy. Defaults toClientRegionShortcut.PROXY
. Use the spring.session.data.gemfire.cache.client.region.shortcut in Spring Boot application.properties.- Returns:
- a
ClientRegionShortcut
used to configure theClientCache
Region
data management policy. - See Also:
-
ClientRegionShortcut
- Default:
- PROXY
-
exposeConfigurationAsProperties
boolean exposeConfigurationAsPropertiesDetermines whether the configuration for Spring Session using Apache Geode or Pivotal GemFire should be exposed in the SpringEnvironment
asProperties
. Currently, users may configure Spring Session for Apache Geode or Pivotal GemFire using attributes on thisAnnotation
, using the well-known and documentedProperties
(e.g. spring.session.data.gemfire.session.expiration.max-inactive-interval-seconds) or using theSpringSessionGemFireConfigurer
declared as a bean in the Spring application context. TheProperties
that are exposed will use the well-known propertynames
that are documented in thisAnnotation's
attributes. The values of the resultingProperties
follows the precedence as outlined in the documentation: first anySpringSessionGemFireConfigurer
bean defined takes precedence, followed by explicitProperties
declared in Spring Boot application.properties and finally, thisAnnotation's
attribute values. Defaults to false. Use spring.session.data.gemfire.session.configuration.expose in Spring Boot application.properties.- Returns:
- a boolean value indicating whether to expose the configuration of Spring Session using Apache Geode
or Pivotal GemFire in the Spring
Environment
asProperties
.
- Default:
- false
-
indexableSessionAttributes
String[] indexableSessionAttributesIdentifies theSession
attributes by name that will be indexed for query operations. For instance, find allSessions
in Apache Geode or Pivotal GemFire having attribute A defined with value X. Defaults to emptyString
array. Use the spring.session.data.gemfire.session.attributes.indexed in Spring Boot application.properties.- Returns:
- an array of
Strings
identifying the names ofSession
attributes to index.
- Default:
- {}
-
maxInactiveIntervalInSeconds
int maxInactiveIntervalInSecondsDefines the maximum interval in seconds that aSession
can remain inactive before it expires. Defaults to 1800 seconds, or 30 minutes. Use the spring.session.data.gemfire.session.expiration.max-inactive-interval-seconds in Spring Boot application.properties.- Returns:
- an integer value defining the maximum inactive interval in seconds before the
Session
expires.
- Default:
- 1800
-
poolName
String poolNameSpecifies the name of the specificPool
used by theClientCache
Region
(i.e. ClusteredSpringSessions) when performing cache data access operations. This is attribute is only used in the client/server topology. Defaults to gemfirePool. Use the spring.session.data.gemfire.cache.client.pool.name in Spring Boot application.properties.- Returns:
- the name of the
Pool
used by theClientCache
Region
to sendSession
state to the cluster of servers. - See Also:
- Default:
- "gemfirePool"
-
regionName
String regionNameDefines thename
of the (client)cacheRegion
used to storeSession
state. Defaults to ClusteredSpringSessions. Use the spring.session.data.gemfire.session.region.name in Spring Boot application.properties.- Returns:
- a
String
specifying the name of the (client)cacheRegion
used to storeSession
state. - See Also:
- Default:
- "ClusteredSpringSessions"
-
serverRegionShortcut
org.apache.geode.cache.RegionShortcut serverRegionShortcutDefines theCache
Region
data management policy. Defaults toRegionShortcut.PARTITION
. Use the spring.session.data.gemfire.cache.server.region.shortcut in Spring Boot application.properties.- Returns:
- a
RegionShortcut
used to specify and configure theCache
Region
data management policy. - See Also:
-
RegionShortcut
- Default:
- PARTITION
-
sessionExpirationPolicyBeanName
String sessionExpirationPolicyBeanNameDefines the name of the bean referring to theSessionExpirationPolicy
used to configure theSession
expiration logic and strategy. Thebean
referred to by itsname
must be of typeSessionExpirationPolicy
. Defaults to unset. Use the spring.session.data.gemfire.session.expiration.bean-name in Spring Boot application.properties.- Returns:
- a
String
containing the bean name of the configuredSessionExpirationPolicy
. - See Also:
- Default:
- ""
-
sessionSerializerBeanName
String sessionSerializerBeanNameDefines the name of the bean referring to theSessionSerializer
used to serializeSession
state between client and server or to disk when persisting or overflowingSession
state. Thebean
referred to by itsname
must be of typeSessionSerializer
. Defaults to SessionPdxSerializer. Use the spring.session.data.gemfire.session.serializer.bean-name in Spring Boot application.properties.- Returns:
- a
String
containing the bean name of the configuredSessionSerializer
. - See Also:
- Default:
- "SessionPdxSerializer"
-