javaspringspring-securityspring-webfluxspring-session

Does Spring Session REST support WebFlux Reactor applications?


I'm planning to integrate Spring Session Redis + Spring Security in WebFlux Project.

And I am looking for some official documentation and references\Sample.But The Document only have Servlet Container Initialization.

I`m not quite sure the Spring Session REST support WebFlux Reactor applications. In my limited experience with Spring,Thanks in advance.

Spring Session and Spring Security: https://docs.spring.io/spring-session/docs/2.5.3/reference/html5/guides/java-security.html#servlet-container-initialization

Spring Session - REST: https://docs.spring.io/spring-session/docs/2.4.6/reference/html5/guides/java-rest.html#servlet-container-initialization


Solution

  • Spring Session provides transparent integration with Spring WebFlux’s WebSession.

    This is documented under "WebSession Integration" in the Spring Session reference docs.

    You can see an example provided by the Spring Session team here.

    If you are using Spring Boot and a single Spring Session module is present on the classpath, Spring Boot uses that store implementation automatically. There is no need for further configuration. You can find additional information in the Spring Boot reference docs.

    If you are not using Spring Boot, you can use the annotation @EnableRedisWebSession to enable WebSession with Redis.