-
Notifications
You must be signed in to change notification settings - Fork 41.4k
Description
Example project:
https://github.com/daliborfilus/spring-boot-redis-ttl-issue
I create this issue as per request in #15757 .
The server.servlet.session.timeout
does not have any effect in my application and producing this minimal example revealed the core issue. I am using Jetty starter and have tomcat starter excluded. Because of some now-strange reasons, I've excluded more dependencies than I should've.
I nailed down the conditions to this (snippet from build.gradle):
Tomcat version (To use tomcat, comment 1) and comment out 3)):
- a) session TTL works in spring boot default mode, i.e. 2) is commented and 4) is commented
- b) session TTL works if 2) is uncommented and 4) is uncommented (replace jakarta.annotation with javax.annotation)
- c) app won't boot if 2) is uncommented and 4) is commented - you need to have at least jakarta.annotation OR javax.annotation present for it to work
Jetty version (To use jetty, uncomment 1) and uncomment 3):
- a) session TTL works if 2) is uncommented and 4) is uncommented (replace jakarta.annotation with javax.annotation)
- b) session TTL works if 2) is commented and 4) is uncommented ("add" javax.annotation dependency with excluding just tomcat)
- b) session TTL doesn't work if 2) is uncommented and 4) is commented (that means no jakarta.annotation nor javax.annotation present, but the app still boots and no errors are visible)
Basically: instead of the app crashing because of missing dependencies, it still works, but Redis TTL doesn't. I don't know what else doesn't work in this situation...
I know that this is now my fault for excluding those dependencies, but I think it's strange the app works without them and this silent issue arises. But only when using Jetty starter. Jetty itself is not dependent on any of the stuff, but Spring autoconfiguration doesn't see them and so it doesn't use them... yet still everything else works.