001/*
002 * Copyright 2012-2017 the original author or authors.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *      http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016
017package org.springframework.boot.autoconfigure.session;
018
019import org.springframework.boot.context.properties.ConfigurationProperties;
020import org.springframework.boot.jdbc.DataSourceInitializationMode;
021
022/**
023 * Configuration properties for JDBC backed Spring Session.
024 *
025 * @author Vedran Pavic
026 * @since 2.0.0
027 */
028@ConfigurationProperties(prefix = "spring.session.jdbc")
029public class JdbcSessionProperties {
030
031        private static final String DEFAULT_SCHEMA_LOCATION = "classpath:org/springframework/"
032                        + "session/jdbc/schema-@@platform@@.sql";
033
034        private static final String DEFAULT_TABLE_NAME = "SPRING_SESSION";
035
036        private static final String DEFAULT_CLEANUP_CRON = "0 * * * * *";
037
038        /**
039         * Path to the SQL file to use to initialize the database schema.
040         */
041        private String schema = DEFAULT_SCHEMA_LOCATION;
042
043        /**
044         * Name of the database table used to store sessions.
045         */
046        private String tableName = DEFAULT_TABLE_NAME;
047
048        /**
049         * Cron expression for expired session cleanup job.
050         */
051        private String cleanupCron = DEFAULT_CLEANUP_CRON;
052
053        /**
054         * Database schema initialization mode.
055         */
056        private DataSourceInitializationMode initializeSchema = DataSourceInitializationMode.EMBEDDED;
057
058        public String getSchema() {
059                return this.schema;
060        }
061
062        public void setSchema(String schema) {
063                this.schema = schema;
064        }
065
066        public String getTableName() {
067                return this.tableName;
068        }
069
070        public void setTableName(String tableName) {
071                this.tableName = tableName;
072        }
073
074        public String getCleanupCron() {
075                return this.cleanupCron;
076        }
077
078        public void setCleanupCron(String cleanupCron) {
079                this.cleanupCron = cleanupCron;
080        }
081
082        public DataSourceInitializationMode getInitializeSchema() {
083                return this.initializeSchema;
084        }
085
086        public void setInitializeSchema(DataSourceInitializationMode initializeSchema) {
087                this.initializeSchema = initializeSchema;
088        }
089
090}