@Target(value=TYPE) @Retention(value=RUNTIME) @Documented @Configuration @Import(value=GemFireHttpSessionConfiguration.class) public @interface EnableGemFireHttpSession
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.Annotation,
Properties,
HttpSession,
Cache,
Region,
ClientCache,
Pool,
Configuration,
Import,
Environment,
Session,
EnableSpringHttpSession,
GemFireHttpSessionConfiguration,
SpringSessionGemFireConfigurer,
SessionExpirationPolicy,
SessionSerializer| Modifier and Type | Optional Element and Description |
|---|---|
org.apache.geode.cache.client.ClientRegionShortcut |
clientRegionShortcut
Defines the
ClientCache Region data management policy. |
boolean |
exposeConfigurationAsProperties
Determines whether the configuration for Spring Session using Apache Geode or Pivotal GemFire should be exposed
in the Spring
Environment as Properties. |
java.lang.String[] |
indexableSessionAttributes
Identifies the
Session attributes by name that will be indexed for query operations. |
int |
maxInactiveIntervalInSeconds
Defines the maximum interval in seconds that a
Session can remain inactive before it expires. |
java.lang.String |
poolName
Specifies the name of the specific
Pool used by the ClientCache Region
(i.e. |
java.lang.String |
regionName
Defines the
name of the (client)cache Region used to store Session state. |
org.apache.geode.cache.RegionShortcut |
serverRegionShortcut
Defines the
Cache Region data management policy. |
java.lang.String |
sessionExpirationPolicyBeanName
Defines the name of the bean referring to the
SessionExpirationPolicy used to configure
the Session expiration logic and strategy. |
java.lang.String |
sessionSerializerBeanName
Defines the name of the bean referring to the
SessionSerializer used to serialize Session state
between client and server or to disk when persisting or overflowing Session state. |
public abstract org.apache.geode.cache.client.ClientRegionShortcut clientRegionShortcut
ClientCache Region data management policy.
Defaults to ClientRegionShortcut.PROXY.
Use the spring.session.data.gemfire.cache.client.region.shortcut in Spring Boot
application.properties.ClientRegionShortcut used to configure the ClientCache Region
data management policy.ClientRegionShortcutpublic abstract boolean exposeConfigurationAsProperties
Environment as Properties.
Currently, users may configure Spring Session for Apache Geode or Pivotal GemFire using attributes on this
Annotation, using the well-known and documented Properties
(e.g. spring.session.data.gemfire.session.expiration.max-inactive-interval-seconds)
or using the SpringSessionGemFireConfigurer declared as a bean in the Spring application context.
The Properties that are exposed will use the well-known property names that are documented
in this Annotation's attributes.
The values of the resulting Properties follows the precedence as outlined in the documentation:
first any SpringSessionGemFireConfigurer bean defined takes precedence, followed by explicit
Properties declared in Spring Boot application.properties and finally, this
Annotation's attribute values.
Defaults to false.
Use spring.session.data.gemfire.session.configuration.expose in Spring Boot
application.properties.Environment as Properties.public abstract java.lang.String[] indexableSessionAttributes
Session attributes by name that will be indexed for query operations.
For instance, find all Sessions in Apache Geode or Pivotal GemFire having attribute A
defined with value X.
Defaults to empty String array.
Use the spring.session.data.gemfire.session.attributes.indexed
in Spring Boot application.properties.Strings identifying the names of Session attributes to index.public abstract int maxInactiveIntervalInSeconds
Session 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.Session expires.public abstract java.lang.String poolName
Pool used by the ClientCache 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.Pool used by the ClientCache Region
to send Session state to the cluster of servers.GemFireHttpSessionConfiguration.DEFAULT_POOL_NAMEpublic abstract java.lang.String regionName
name of the (client)cache Region used to store Session state.
Defaults to ClusteredSpringSessions.
Use the spring.session.data.gemfire.session.region.name in Spring Boot
application.properties.String specifying the name of the (client)cache Region
used to store Session state.GemFireHttpSessionConfiguration.DEFAULT_SESSION_REGION_NAMEpublic abstract org.apache.geode.cache.RegionShortcut serverRegionShortcut
Cache Region data management policy.
Defaults to RegionShortcut.PARTITION.
Use the spring.session.data.gemfire.cache.server.region.shortcut in Spring Boot
application.properties.RegionShortcut used to specify and configure the Cache Region
data management policy.RegionShortcutpublic abstract java.lang.String sessionExpirationPolicyBeanName
SessionExpirationPolicy used to configure
the Session expiration logic and strategy.
The bean referred to by its name must be of type SessionExpirationPolicy.
Defaults to unset.
Use the spring.session.data.gemfire.session.expiration.bean-name in Spring Boot
application.properties.String containing the bean name of the configured SessionExpirationPolicy.SessionExpirationPolicypublic abstract java.lang.String sessionSerializerBeanName
SessionSerializer used to serialize Session state
between client and server or to disk when persisting or overflowing Session state.
The bean referred to by its name must be of type SessionSerializer.
Defaults to SessionPdxSerializer.
Use the spring.session.data.gemfire.session.serializer.bean-name in Spring Boot
application.properties.String containing the bean name of the configured SessionSerializer.PdxSerializableSessionSerializer,
SessionSerializer