@Configuration(proxyBeanMethods=false)
public class SpringHttpSessionConfiguration
extends java.lang.Object
implements org.springframework.context.ApplicationContextAware
SessionRepository
. For example:
@Configuration @EnableSpringHttpSession public class SpringHttpSessionConfig { @Bean public MapSessionRepository sessionRepository() { return new MapSessionRepository(new ConcurrentHashMap<>()); } }
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 |
setHttpSessionIdResolver(HttpSessionIdResolver httpSessionIdResolver) |
void |
setHttpSessionListeners(java.util.List<javax.servlet.http.HttpSessionListener> listeners) |
void |
setServletContext(javax.servlet.ServletContext servletContext) |
<S extends Session> |
springSessionRepositoryFilter(SessionRepository<S> sessionRepository) |
@PostConstruct public void init()
@Bean public SessionEventHttpSessionListenerAdapter sessionEventHttpSessionListenerAdapter()
@Bean public <S extends Session> SessionRepositoryFilter<? extends Session> springSessionRepositoryFilter(SessionRepository<S> sessionRepository)
public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext) throws org.springframework.beans.BeansException
setApplicationContext
in interface org.springframework.context.ApplicationContextAware
org.springframework.beans.BeansException
@Autowired(required=false) public void setServletContext(javax.servlet.ServletContext servletContext)
@Autowired(required=false) public void setCookieSerializer(CookieSerializer cookieSerializer)
@Autowired(required=false) public void setHttpSessionIdResolver(HttpSessionIdResolver httpSessionIdResolver)
@Autowired(required=false) public void setHttpSessionListeners(java.util.List<javax.servlet.http.HttpSessionListener> listeners)