CelinHC
CelinHC

Reputation: 1984

Disable session on embedded http server

Can these properties used to disable the session mechanism completely?

server.session.persistent=false
server.session.timeout=0

If not, how to do this?

Upvotes: 11

Views: 6133

Answers (3)

Vagner Nogueira
Vagner Nogueira

Reputation: 151

try type in application.properties:

spring.session.store-type=none

...to disable spring session

See: https://docs.spring.io/spring-boot/docs/2.2.0.RELEASE/reference/htmlsingle/#boot-features-session

Upvotes: 1

MuratOzkan
MuratOzkan

Reputation: 2750

A couple of notes for posterity:

  1. Persistent sessions are sessions that survive server restarts, thus, when you enable that, Spring will serialize and store your session somewhere to load it later.
  2. For a complete discussion on how to reliably disable sessions, please see this post: Can I turn off the HttpSession in web.xml?

Upvotes: -1

Related Questions