@Retention(value=RUNTIME) @Target(value=TYPE) @Documented @Import(value=JdbcHttpSessionConfiguration.class) @Configuration public @interface EnableJdbcHttpSession
@Configuration
class to expose the
SessionRepositoryFilter as a bean named "springSessionRepositoryFilter" and backed by a
relational database. In order to leverage the annotation, a single
DataSource
must be provided. For example:
@Configuration @EnableJdbcHttpSession public class JdbcHttpSessionConfig { @Bean public DataSource dataSource() { return new EmbeddedDatabaseBuilder() .setType(EmbeddedDatabaseType.H2) .addScript("org/springframework/session/jdbc/schema-h2.sql") .build(); } @Bean public PlatformTransactionManager transactionManager(DataSource dataSource) { return new DataSourceTransactionManager(dataSource); } }More advanced configurations can extend
JdbcHttpSessionConfiguration
instead.
For additional information on how to configure data access related concerns, please
refer to the
Spring Framework Reference Documentation.EnableSpringHttpSession
Modifier and Type | Optional Element and Description |
---|---|
int |
maxInactiveIntervalInSeconds
The session timeout in seconds.
|
java.lang.String |
tableName
The name of database table used by Spring Session to store sessions.
|