Skip to content

Commit ee668e6

Browse files
committed
Polish contribution
Closes gh-6651
1 parent 06a1f44 commit ee668e6

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/batch/BatchProperties.java

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,15 +73,20 @@ public String getTablePrefix() {
7373
public class Initializer {
7474

7575
/**
76-
* Create the required batch tables on startup if necessary.
76+
* Create the required batch tables on startup if necessary. Enabled
77+
* automatically if no custom table prefix is set or if a custom schema is
78+
* configured.
7779
*/
78-
private boolean enabled = true;
80+
private Boolean enabled;
7981

8082
public boolean isEnabled() {
81-
boolean isDefaultTablePrefix = BatchProperties.this.getTablePrefix() == null;
82-
boolean isDefaultSchema = DEFAULT_SCHEMA_LOCATION.equals(
83+
if (this.enabled != null) {
84+
return this.enabled;
85+
}
86+
boolean defaultTablePrefix = BatchProperties.this.getTablePrefix() == null;
87+
boolean customSchema = !DEFAULT_SCHEMA_LOCATION.equals(
8388
BatchProperties.this.getSchema());
84-
return this.enabled && (isDefaultTablePrefix || !isDefaultSchema);
89+
return (defaultTablePrefix || customSchema);
8590
}
8691

8792
public void setEnabled(boolean enabled) {

spring-boot-docs/src/main/asciidoc/appendix-application-properties.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -847,7 +847,7 @@ content into your application; rather pick only the properties that you need.
847847
spring.artemis.user= # Login user of the broker.
848848
849849
# SPRING BATCH ({sc-spring-boot-autoconfigure}/batch/BatchProperties.{sc-ext}[BatchProperties])
850-
spring.batch.initializer.enabled=true # Create the required batch tables on startup if necessary.
850+
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.
851851
spring.batch.job.enabled=true # Execute all Spring Batch jobs in the context on startup.
852852
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.
853853
spring.batch.schema=classpath:org/springframework/batch/core/schema-@@platform@@.sql # Path to the SQL file to use to initialize the database schema.

0 commit comments

Comments
 (0)