In the previous step, Servlet Filter needs to be enabled on every request to the Servlet Container (Tomcat). The following snippet shows the code involved:
public class Initializer extends AbstractHttpSessionApplicationInitializer { public Initializer() { super(ApplicationConfiguration.class); } }
That's all the configuration you would need. The great thing with Spring Session is the fact that your application code talking to HTTPSession does not change! You can continue using the HttpSession interface, but in the background, Spring Session ensures that the session data is stored to an external data store - Redis in this example:
req.getSession().setAttribute(name, ...