Annotation Interface EnableMongoHttpSession
@Retention(RUNTIME)
@Target(TYPE)
@Documented
@Import(MongoHttpSessionConfiguration.class)
public @interface EnableMongoHttpSession
Add this annotation to a
@Configuration
class to expose the
SessionRepositoryFilter as a bean named "springSessionRepositoryFilter" and backed by
Mongo. Use collectionName
to change default name of the collection used to
store sessions.
@Configuration(proxyBeanMethods = false)
@EnableMongoHttpSession
public class MongoHttpSessionConfig {
@Bean
public MongoOperations mongoOperations() throws UnknownHostException {
return new MongoTemplate(new MongoClient(), "databaseName");
}
}
- Since:
- 1.2
-
Optional Element Summary
Modifier and TypeOptional ElementDescriptionThe collection name to use.int
The maximum time a session will be kept if it is inactive.
-
Element Details
-
maxInactiveIntervalInSeconds
int maxInactiveIntervalInSecondsThe maximum time a session will be kept if it is inactive.- Returns:
- default max inactive interval in seconds
- Default:
- 1800
-
collectionName
String collectionNameThe collection name to use.- Returns:
- name of the collection to store session
- Default:
- "sessions"
-