Class SessionSchemaEnvironmentPostProcessor
- All Implemented Interfaces:
org.springframework.boot.env.EnvironmentPostProcessor,org.springframework.core.Ordered
This starter puts spring-session-jdbc on the classpath, so HTTP sessions are
persisted in the application datasource in every mode (server and desktop). Spring
Boot only auto-creates the SPRING_SESSION tables for in-memory embedded
databases (the initialize-schema=embedded default). So on PostgreSQL and on a
file-backed H2 the tables are never created and the first session write fails with
Table "SPRING_SESSION" not found / relation "spring_session" does not exist —
e.g. a 500 on login from a plain bootRun with the default jdbc:h2:file: url.
For those datasources we force initialize-schema=always pointed at an idempotent
(IF NOT EXISTS) mirror of the upstream schema, so it is safe to run on every boot
against the persistent database. Defaults go in at lowest precedence so an application can
still override them. In-memory H2 needs nothing — Spring Boot initializes that itself.
-
Field Summary
Fields inherited from interface org.springframework.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintgetOrder()voidpostProcessEnvironment(org.springframework.core.env.ConfigurableEnvironment environment, org.springframework.boot.SpringApplication application)
-
Constructor Details
-
SessionSchemaEnvironmentPostProcessor
public SessionSchemaEnvironmentPostProcessor()
-
-
Method Details
-
postProcessEnvironment
public void postProcessEnvironment(org.springframework.core.env.ConfigurableEnvironment environment, org.springframework.boot.SpringApplication application) - Specified by:
postProcessEnvironmentin interfaceorg.springframework.boot.env.EnvironmentPostProcessor
-
getOrder
public int getOrder()- Specified by:
getOrderin interfaceorg.springframework.core.Ordered
-