From ee668e6782eb877cf38f2bcf617eb7e61bda7dbe Mon Sep 17 00:00:00 2001 From: Stephane Nicoll Date: Mon, 12 Sep 2016 14:53:02 +0200 Subject: [PATCH] Polish contribution Closes gh-6651 --- .../boot/autoconfigure/batch/BatchProperties.java | 15 ++++++++++----- .../asciidoc/appendix-application-properties.adoc | 2 +- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/batch/BatchProperties.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/batch/BatchProperties.java index 17e0e7b38ef..ae32dec5a6d 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/batch/BatchProperties.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/batch/BatchProperties.java @@ -73,15 +73,20 @@ public class BatchProperties { public class Initializer { /** - * Create the required batch tables on startup if necessary. + * Create the required batch tables on startup if necessary. Enabled + * automatically if no custom table prefix is set or if a custom schema is + * configured. */ - private boolean enabled = true; + private Boolean enabled; public boolean isEnabled() { - boolean isDefaultTablePrefix = BatchProperties.this.getTablePrefix() == null; - boolean isDefaultSchema = DEFAULT_SCHEMA_LOCATION.equals( + if (this.enabled != null) { + return this.enabled; + } + boolean defaultTablePrefix = BatchProperties.this.getTablePrefix() == null; + boolean customSchema = !DEFAULT_SCHEMA_LOCATION.equals( BatchProperties.this.getSchema()); - return this.enabled && (isDefaultTablePrefix || !isDefaultSchema); + return (defaultTablePrefix || customSchema); } public void setEnabled(boolean enabled) { diff --git a/spring-boot-docs/src/main/asciidoc/appendix-application-properties.adoc b/spring-boot-docs/src/main/asciidoc/appendix-application-properties.adoc index 8b29e94dd3b..346056fb2cc 100644 --- a/spring-boot-docs/src/main/asciidoc/appendix-application-properties.adoc +++ b/spring-boot-docs/src/main/asciidoc/appendix-application-properties.adoc @@ -847,7 +847,7 @@ content into your application; rather pick only the properties that you need. spring.artemis.user= # Login user of the broker. # SPRING BATCH ({sc-spring-boot-autoconfigure}/batch/BatchProperties.{sc-ext}[BatchProperties]) - spring.batch.initializer.enabled=true # Create the required batch tables on startup if necessary. + spring.batch.initializer.enabled= # Create the required batch tables on startup if necessary. Enabled automatically if no custom table prefix is set or if a custom schema is configured. spring.batch.job.enabled=true # Execute all Spring Batch jobs in the context on startup. spring.batch.job.names= # Comma-separated list of job names to execute on startup (For instance `job1,job2`). By default, all Jobs found in the context are executed. spring.batch.schema=classpath:org/springframework/batch/core/schema-@@platform@@.sql # Path to the SQL file to use to initialize the database schema.