@Retention(value=RUNTIME) @Target(value=TYPE) @Documented @Import(value=RedisWebSessionConfiguration.class) @Configuration(proxyBeanMethods=false) public @interface EnableRedisWebSession
@Configuration
class to expose the
WebSessionManager
as a bean named webSessionManager
and backed by
Reactive Redis. In order to leverage the annotation, a single
ReactiveRedisConnectionFactory
must be provided. For example:
@Configuration @EnableRedisWebSession public class RedisWebSessionConfig { @Bean public LettuceConnectionFactory redisConnectionFactory() { return new LettuceConnectionFactory(); } }More advanced configurations can extend
RedisWebSessionConfiguration
instead.EnableSpringWebSession
Modifier and Type | Optional Element and Description |
---|---|
int |
maxInactiveIntervalInSeconds
The session timeout in seconds.
|
RedisFlushMode |
redisFlushMode
Deprecated.
since 2.2.0 as support
IMMEDIATE is removed |
java.lang.String |
redisNamespace
Defines a unique namespace for keys.
|
SaveMode |
saveMode
Save mode for the session.
|
public abstract int maxInactiveIntervalInSeconds
public abstract java.lang.String redisNamespace
spring:session:
to
<redisNamespace>:
.
For example, if you had an application named "Application A" that needed to keep the sessions isolated from "Application B" you could set two different values for the applications and they could function within the same Redis instance.
@Deprecated public abstract RedisFlushMode redisFlushMode
IMMEDIATE
is removedON_SAVE
which only
updates the backing Redis when ReactiveSessionRepository.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 Redis instance.
RedisFlushMode
to usepublic abstract SaveMode saveMode
SaveMode.ON_SET_ATTRIBUTE
, which
only saves changes made to session.