I am trying to switch my http session to redis in my spring boot application.
When the first request comes to backend it’s being filtered by authentication filter.
One duty of this filter is to populate user session bean with data. The session is succesfully saved to the redis instance at this step, but the delta of changes ( which should include the session bean) is not invoked. I want to point out that with storing session on tomcat the session beans work correctly.
So why session bean populated on OnePerRequest filter is not updated as the delta of session ?
2
Answers
Have you tried the below configuration?
Try changing the flush mode to
IMMEDIATE
, by default it’sON_SAVE
which means you explicitly have to save the session or in a managed environment, it happens before the response is serialized (I think).In
src/main/resources/application.properties
you could do:Or using @EnableRedisHttpSession do: