Add the following configuration to your JavaConfig:
@Bean
ServletContextInitializer servletContextInitializer() {
// keep session only in cookie so that jsessionid is not appended to URL.
return servletContext -> servletContext.setSessionTrackingModes(
Collections.singleton(SessionTrackingMode.COOKIE));
}
This is equivalent to
<session-config>
<tracking-mode>COOKIE</tracking-mode>
</session-config>
in web.xml
Postscript 2015-10-04
@nicolas_frankel With 1.3 there is a property: `server.session.tracking-modes=cookie`
— Phil Webb (@phillip_webb) 2015, 9月 25
Awesome!