A code snippet for a specific case
@Configuration
@NewEnableRedisHttpSession(maxInactiveIntervalInSeconds = 900)
@Import({RedisConfiguration.class})
Here is a annotation value: maxInactiveIntervalInSeconds = 900
@NewEnableRedisHttpSession(maxInactiveIntervalInSeconds = 900)
I want to configure it like
@NewEnableRedisHttpSession("${maxInactiveIntervalInSeconds}")
some configuration file will give the value
maxInactiveIntervalInSeconds = 900
CodePudding user response:
use
@EnableRedisHttpSession(maxInactiveIntervalInSeconds = intervalInSeconds)
more specific for your need
@EnableRedisHttpSession(maxInactiveIntervalInSeconds = 900)
default value is 1800
.
See https://docs.spring.io/spring-session/docs/current/api/index.html?org/springframework/session/data/redis/config/annotation/web/http/EnableRedisHttpSession.html section maxInactiveIntervalInSeconds
.
Supplement based on comment. Do like this, in case you want get value from application.properties
spring.session.timeout=9000
@Value("${spring.session.timeout}")
private Integer maxInactiveIntervalInSeconds;