@Configuration public class SpringHttpSessionConfiguration extends Object implements org.springframework.context.ApplicationContextAware
SessionRepository. For example:
@Configuration
@EnableSpringHttpSession
public class SpringHttpSessionConfig {
@Bean
public MapSessionRepository sessionRepository() {
return new MapSessionRepository();
}
}
It is important to note that no infrastructure for session expirations is configured for you out of the box. This is because things like session expiration are highly implementation dependent. This means if you require cleaning up expired sessions, you are responsible for cleaning up the expired sessions.
The following is provided for you with the base configuration:
SessionCreatedEvent and
SessionDestroyedEvent.EnableSpringHttpSession| Constructor and Description |
|---|
SpringHttpSessionConfiguration() |
| Modifier and Type | Method and Description |
|---|---|
void |
init() |
SessionEventHttpSessionListenerAdapter |
sessionEventHttpSessionListenerAdapter() |
void |
setApplicationContext(org.springframework.context.ApplicationContext applicationContext) |
void |
setCookieSerializer(CookieSerializer cookieSerializer) |
void |
setHttpSessionListeners(List<HttpSessionListener> listeners) |
void |
setHttpSessionStrategy(HttpSessionStrategy httpSessionStrategy) |
void |
setServletContext(ServletContext servletContext) |
<S extends ExpiringSession> |
springSessionRepositoryFilter(SessionRepository<S> sessionRepository) |
@PostConstruct public void init()
@Bean public SessionEventHttpSessionListenerAdapter sessionEventHttpSessionListenerAdapter()
@Bean public <S extends ExpiringSession> SessionRepositoryFilter<? extends ExpiringSession> springSessionRepositoryFilter(SessionRepository<S> sessionRepository)
public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
throws org.springframework.beans.BeansException
setApplicationContext in interface org.springframework.context.ApplicationContextAwareorg.springframework.beans.BeansException@Autowired(required=false) public void setServletContext(ServletContext servletContext)
@Autowired(required=false) public void setCookieSerializer(CookieSerializer cookieSerializer)
@Autowired(required=false) public void setHttpSessionStrategy(HttpSessionStrategy httpSessionStrategy)
@Autowired(required=false) public void setHttpSessionListeners(List<HttpSessionListener> listeners)