Springboot会话存储的类型:
- JDBC
- MongoDB
- Redis
- Hazelcast
- HashMap
例如:
spring.session.store-type=jdbc
spring.session.jdbc.table-name=SPRING_SESSION # 默认
spring.session.store-type=mongodb
spring.session.mongo.collection-name=sessions # 默认
# SPRING SESSION (SessionProperties)
spring.session.hazelcast.flush-mode=on-save # Sessions flush mode. spring.session.hazelcast.map-name=spring:session:sessions # Name of the map used to store sessions. spring.session.jdbc.initializer.enabled= # Create the required session tables on startup if necessary. Enabled automatically if the default table name is set or a custom schema is configured. spring.session.jdbc.schema=classpath:org/springframework/session/jdbc/schema-@@platform@@.sql # Path to the SQL file to use to initialize the database schema. spring.session.jdbc.table-name=SPRING_SESSION # Name of database table used to store sessions. spring.session.mongo.collection-name=sessions # Collection name used to store sessions. spring.session.redis.flush-mode=on-save # Sessions flush mode. spring.session.redis.namespace= # Namespace for keys used to store sessions. spring.session.store-type= # Session store type.
禁用会话:
spring.session.store-type=none