5

I would like to utilize spring-boot + spring-session WITHOUT Redis but use dynamodb as the sessionRepository implementation.

All of the examples available are tightly coupled with Redis or Hazelcast and are mostly auto configurations that abstract away what beans are being initialized. Moreover, my spring boot config explicitly defines a

@Bean
    public TomcatEmbeddedServletContainerFactory tomcatEmbeddedServletContainerFactory(Environment env) {

        TomcatEmbeddedServletContainerFactory factory = new TomcatEmbeddedServletContainerFactory();

return factory;
}

I have also disabled the spring-boot autoconfiguration SessionAutoConfiguration.class for spring-session.

So I have a couple of questions.

1. How do I configure my spring-boot project that has an explicitly defined TomcatEmbeddedServletContainerFactory bean to utilize use spring-session?

2. I noticed spring-session is tightly coupled with Redis and Hazelcast (and nothing else). Are there any objections to using a store like amazon dynamodb for the session repository impl?

I was looking at https://github.com/spring-projects/spring-session/blob/master/spring-session/src/main/java/org/springframework/session/config/annotation/web/http/SpringHttpSessionConfiguration.java

to give me an idea of how to configure what I want to achieve but I keep running into initialization exceptions. If somebody could point in the right direction I would greatly appreciate it.

using spring-session version: 1.1.0.M1

Gajanan Kulkarni
  • 697
  • 6
  • 22
Selwyn
  • 3,118
  • 1
  • 26
  • 33

1 Answers1

5

I have also disabled the spring-boot autoconfiguration SessionAutoConfiguration.class for spring-session.

If you do not have Redis on your classpath you should not need to disable the auto configuration.

How do I configure my spring-boot project that has an explicitly defined TomcatEmbeddedServletContainerFactory bean to utilize use spring-session?

The 1.1.0.M1 reference discusses how to do this with @EnableSpringHttpSession. For example:

@EnableSpringHttpSession
@Configuration
public class SpringHttpSessionConfig {
        @Bean
        public CusttomSessionRepository sessionRepository() {
                return new CusttomSessionRepository();
        }
}

I noticed spring-session is tightly coupled with Redis and Hazelcast (and nothing else). Are there any objections to using a store like amazon dynamodb for the session repository impl?

We would love contributions for different data stores (in fact we are getting support for GemFire). The problem is really more about time to implement them all.

to give me an idea of how to configure what I want to achieve but I keep running into initialization exceptions.

It sounds as you are trying some of the suggestions I have provided. However, I cannot help unless you provide details about the exceptions you are getting.

Rob Winch
  • 21,440
  • 2
  • 59
  • 76
  • thanks, question do I need to add a [ FilterRegistrationBean sessionRepositoryFilterRegistration(SessionRepositoryFilter springSessionRepositoryFilter) ] Bean with the above config? or will it automatically register 1 and map the `springSessionRepositoryFilter -> "/*" urls` – Selwyn Jan 22 '16 at 23:23