-
Notifications
You must be signed in to change notification settings - Fork 41.6k
Description
Spring Session has support for configuring session cookie using Servlet API's SessionCookieConfig
, so one would expect it would be possible to configure session cookie using Boot's ServerProperties
. This however does not work due to following reasons.
The problem is that Spring Session's CookieSerializer
is configured in SpringHttpSessionConfiguration
while Boot's customization of SessionCookieConfig
with ServerProperties
is done in DefaultServletWebServerFactoryCustomizer.SessionConfiguringInitializer
and happens after Spring Session has been initializing.
The problem can be observed using spring-boot-sample-session
with configuration property server.session.cookie.name=sid
, and breakpoints set in org.springframework.boot.autoconfigure.web.servlet.DefaultServletWebServerFactoryCustomizer.SessionConfiguringInitializer#configureSessionCookie
and org.springframework.session.config.annotation.web.http.SpringHttpSessionConfiguration#createDefaultCookieSerializer
.
Related to #7141.