1

I'm trying to get Spring Session timeout changed to a longer default value and also to have the cookie be persistent instead of session only. I'm using spring-session-jdbc for session storage.

I've put into the application.properties file the following:

#Distributed Session Storage for use by stateless apps
spring.session.store-type=jdbc
spring.session.jdbc.initialize-schema=always

server.servlet.session.timeout=1d
server.servlet.session.cookie.max-age=1d
server.servlet.session.cookie.same-site=strict

Other settings in the application.properties file are applied as expected.

It only seems to be the session and cookie settings that aren't being applied.

This is a Spring Boot Jar run via java -jar. The database is MariaDB and sessions are created and managed correctly, but I can't seem to change the cookie or timeout settings.

Help appreciated. -Michael/NewsRx

6
  • Perhaps try server.servlet.session.tracking-modes=cookie Commented Sep 13, 2022 at 17:59
  • No change when adding this. Commented Sep 13, 2022 at 18:06
  • I believe the JDBC session timeout is configured depending on the Connection Pool library. Settings server.servlet. are the configurations for the web server. If that's the case check this post out: stackoverflow.com/questions/55511297/… Commented Sep 13, 2022 at 18:09
  • Not having any issues with the JDBC connection. The issue is with the HTTP Session timeout and cookie settings. Commented Sep 13, 2022 at 18:17
  • Your question states: "Spring Session JDBC timeout changed" Commented Sep 13, 2022 at 18:18

1 Answer 1

0

This was caused by Docker not picking up property file changes when rebuilding the container.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.