From 1761ff0ff48c00a6e732bc2ea057f5d24e60b261 Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Mon, 24 Nov 2025 11:37:02 +0000 Subject: [PATCH] Clarify Batch docs on the need for a DataSource and DB-based repository Closes gh-48233 --- .../docs/antora/modules/ROOT/pages/redirect.adoc | 4 ++-- .../src/docs/antora/modules/how-to/pages/batch.adoc | 13 +++---------- 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/documentation/spring-boot-docs/src/docs/antora/modules/ROOT/pages/redirect.adoc b/documentation/spring-boot-docs/src/docs/antora/modules/ROOT/pages/redirect.adoc index c09fcabc9e8..07285422bff 100644 --- a/documentation/spring-boot-docs/src/docs/antora/modules/ROOT/pages/redirect.adoc +++ b/documentation/spring-boot-docs/src/docs/antora/modules/ROOT/pages/redirect.adoc @@ -393,8 +393,8 @@ * xref:how-to:batch.adoc#howto.batch.specifying-a-data-source[#howto-spring-batch-specifying-a-data-source] * xref:how-to:batch.adoc#howto.batch.specifying-a-data-source[#howto.batch.specifying-a-data-source] * xref:how-to:batch.adoc#howto.batch.specifying-a-transaction-manager[#howto.batch.specifying-a-transaction-manager] -* xref:how-to:batch.adoc#howto.batch.storing-job-repository[#howto-spring-batch-storing-job-repository] -* xref:how-to:batch.adoc#howto.batch.storing-job-repository[#howto.batch.storing-job-repository] +* xref:reference:io/spring-batch.adoc#io.spring-batch[#howto-spring-batch-storing-job-repository] +* xref:reference:io/spring-batch.adoc#io.spring-batch[#howto.batch.storing-job-repository] * xref:how-to:batch.adoc#howto.batch[#howto-batch-applications] * xref:how-to:batch.adoc#howto.batch[#howto.batch] * xref:how-to:build.adoc#howto.build.build-an-executable-archive-with-ant-without-using-spring-boot-antlib[#howto-build-an-executable-archive-with-ant] diff --git a/documentation/spring-boot-docs/src/docs/antora/modules/how-to/pages/batch.adoc b/documentation/spring-boot-docs/src/docs/antora/modules/how-to/pages/batch.adoc index 5ed7d1ab632..390b333ac17 100644 --- a/documentation/spring-boot-docs/src/docs/antora/modules/how-to/pages/batch.adoc +++ b/documentation/spring-boot-docs/src/docs/antora/modules/how-to/pages/batch.adoc @@ -9,9 +9,9 @@ This section addresses those questions. [[howto.batch.specifying-a-data-source]] == Specifying a Batch Data Source -By default, batch applications require a javadoc:javax.sql.DataSource[] to store job details. -Spring Batch expects a single javadoc:javax.sql.DataSource[] by default. -To have it use a javadoc:javax.sql.DataSource[] other than the application’s main javadoc:javax.sql.DataSource[], declare a javadoc:javax.sql.DataSource[] bean, annotating its javadoc:org.springframework.context.annotation.Bean[format=annotation] method with javadoc:org.springframework.boot.batch.jdbc.autoconfigure.BatchDataSource[format=annotation]. +Batch applications that store job details in an SQL database require a javadoc:javax.sql.DataSource[] bean. +A single javadoc:javax.sql.DataSource[] bean is required by default. +To have Spring Batch use a javadoc:javax.sql.DataSource[] other than the application’s main javadoc:javax.sql.DataSource[], declare a javadoc:javax.sql.DataSource[] bean, annotating its javadoc:org.springframework.context.annotation.Bean[format=annotation] method with javadoc:org.springframework.boot.batch.jdbc.autoconfigure.BatchDataSource[format=annotation]. If you do so and want two data sources (for example by retaining the main auto-configured javadoc:javax.sql.DataSource[]), set the `defaultCandidate` attribute of the javadoc:org.springframework.context.annotation.Bean[format=annotation] annotation to `false`. @@ -66,10 +66,3 @@ This allows them to be modified or removed. NOTE: When you're using a custom javadoc:org.springframework.batch.core.JobParametersIncrementer[], you have to gather all parameters managed by the incrementer to restart a failed execution. - -[[howto.batch.storing-job-repository]] -== Storing the Job Repository - -Spring Batch requires a data store for the javadoc:org.springframework.batch.core.Job[] repository. -If you use Spring Boot, you must use an actual database. -Note that it can be an in-memory database, see {url-spring-batch-docs}/job.html#configuringJobRepository[Configuring a Job Repository].