이 콘텐츠는 선택한 언어로 제공되지 않습니다.
Chapter 2. Externalizing sessions with Spring Session
Store session data for Spring applications in Data Grid caches and independently of the container.
2.1. Externalizing Sessions with Spring Session 링크 복사링크가 클립보드에 복사되었습니다!
Use the Spring Session API to externalize session data to Data Grid.
Procedure
Add dependencies to your
pom.xml
.-
Embedded caches:
infinispan-spring6-embedded
Remote caches:
infinispan-spring6-remote
The following example is for remote caches:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
-
Embedded caches:
Specify the appropriate
FactoryBean
to expose aCacheManager
instance.-
Embedded caches:
SpringEmbeddedCacheManagerFactoryBean
-
Remote caches:
SpringRemoteCacheManagerFactoryBean
-
Embedded caches:
Enable Spring Session with the appropriate annotation.
-
Embedded caches:
@EnableInfinispanEmbeddedHttpSession
Remote caches:
@EnableInfinispanRemoteHttpSession
These annotations have optional parameters:
-
maxInactiveIntervalInSeconds
sets session expiration time in seconds. The default is1800
. -
cacheName
specifies the name of the cache that stores sessions. The default issessions
.
-
-
Embedded caches:
The following example shows a complete, annotation-based configuration: