8

Why does not spring.session.store-type has in memory option. ?

Is there any way to use spring session with in memory option without writing my implementation of store ?

I would like to use spring session for rest api with token

 @Bean
  public HttpSessionIdResolver httpSessionIdResolver() {
    return HeaderHttpSessionIdResolver.xAuthToken();
  }
dur
  • 15,689
  • 25
  • 79
  • 125
user1321466
  • 1,889
  • 2
  • 21
  • 29

1 Answers1

18

I found solution, there is a MapSessionRepository which can accept map. here is a documentation EnableSpringHttpSession

@EnableSpringHttpSession
@Configuration
public class SpringHttpSessionConfig {
    @Bean
    public MapSessionRepository sessionRepository() {
        return new MapSessionRepository(new ConcurrentHashMap<>());
    }
}
user1321466
  • 1,889
  • 2
  • 21
  • 29
  • This is great! We use spring-session with redis but not for local testing so catalina.session.StandardSession was being used. With your code, I can use HttpSession without needing redis and it's much better for testing. – antak Nov 01 '19 at 12:22