Search in sources :

Example 1 with SpringSessionWebSessionStore

use of org.springframework.session.web.server.session.SpringSessionWebSessionStore in project spring-session by spring-projects.

the class SpringWebSessionConfiguration method webSessionManager.

/**
 * Configure a {@link WebSessionManager} using a provided {@link ReactiveSessionRepository}.
 *
 * @param repository a bean that implements {@link ReactiveSessionRepository}.
 * @return a configured {@link WebSessionManager} registered with a preconfigured name.
 */
@Bean(WebHttpHandlerBuilder.WEB_SESSION_MANAGER_BEAN_NAME)
public WebSessionManager webSessionManager(ReactiveSessionRepository<? extends Session> repository) {
    SpringSessionWebSessionStore<? extends Session> sessionStore = new SpringSessionWebSessionStore<>(repository);
    DefaultWebSessionManager manager = new DefaultWebSessionManager();
    manager.setSessionStore(sessionStore);
    if (this.webSessionIdResolver != null) {
        manager.setSessionIdResolver(this.webSessionIdResolver);
    }
    return manager;
}
Also used : SpringSessionWebSessionStore(org.springframework.session.web.server.session.SpringSessionWebSessionStore) DefaultWebSessionManager(org.springframework.web.server.session.DefaultWebSessionManager) Bean(org.springframework.context.annotation.Bean)

Aggregations

Bean (org.springframework.context.annotation.Bean)1 SpringSessionWebSessionStore (org.springframework.session.web.server.session.SpringSessionWebSessionStore)1 DefaultWebSessionManager (org.springframework.web.server.session.DefaultWebSessionManager)1