-
Notifications
You must be signed in to change notification settings - Fork 41.2k
server.servlet.session.timeout not in effect when using Jetty starter without jakarta.annotation and javax.annotation #23716
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Thanks for the sample. I understand the behaviour now. As you have observed, Tomcat requires There's a method on Lines 67 to 72 in 2916bb4
When In general terms, this is standard JVM behaviour and I don't think we should do anything to change it so that, for example, and app would always fail to start without the One way to fix this would be to switch to implementing |
#23723 has been opened for this. |
That is ... very interesting. One more thing I found was also broken by this was HAL response/ request? converters. GET /api/... Accept: application/json but I thought this was a change in Spring / HAL libraries - so it returns HAL format only for Accept: application/hal+json, |
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.
The text was updated successfully, but these errors were encountered: