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.batch; 018 019import org.springframework.boot.context.properties.ConfigurationProperties; 020import org.springframework.boot.jdbc.DataSourceInitializationMode; 021 022/** 023 * Configuration properties for Spring Batch. 024 * 025 * @author Stephane Nicoll 026 * @author EddĂș MelĂ©ndez 027 * @author Vedran Pavic 028 * @since 1.2.0 029 */ 030@ConfigurationProperties(prefix = "spring.batch") 031public class BatchProperties { 032 033 private static final String DEFAULT_SCHEMA_LOCATION = "classpath:org/springframework/" 034 + "batch/core/schema-@@platform@@.sql"; 035 036 /** 037 * Path to the SQL file to use to initialize the database schema. 038 */ 039 private String schema = DEFAULT_SCHEMA_LOCATION; 040 041 /** 042 * Table prefix for all the batch meta-data tables. 043 */ 044 private String tablePrefix; 045 046 /** 047 * Database schema initialization mode. 048 */ 049 private DataSourceInitializationMode initializeSchema = DataSourceInitializationMode.EMBEDDED; 050 051 private final Job job = new Job(); 052 053 public String getSchema() { 054 return this.schema; 055 } 056 057 public void setSchema(String schema) { 058 this.schema = schema; 059 } 060 061 public String getTablePrefix() { 062 return this.tablePrefix; 063 } 064 065 public void setTablePrefix(String tablePrefix) { 066 this.tablePrefix = tablePrefix; 067 } 068 069 public DataSourceInitializationMode getInitializeSchema() { 070 return this.initializeSchema; 071 } 072 073 public void setInitializeSchema(DataSourceInitializationMode initializeSchema) { 074 this.initializeSchema = initializeSchema; 075 } 076 077 public Job getJob() { 078 return this.job; 079 } 080 081 public static class Job { 082 083 /** 084 * Comma-separated list of job names to execute on startup (for instance, 085 * `job1,job2`). By default, all Jobs found in the context are executed. 086 */ 087 private String names = ""; 088 089 public String getNames() { 090 return this.names; 091 } 092 093 public void setNames(String names) { 094 this.names = names; 095 } 096 097 } 098 099}