Add support for configuring a Batch-specific DataSource

See gh-17375
This commit is contained in:
Dmytro Nosan
2019-07-01 15:12:09 +03:00
committed by Andy Wilkinson
parent f7850ef898
commit f449665e2a
5 changed files with 91 additions and 9 deletions

View File

@@ -2429,8 +2429,12 @@ other factory that your application defines, if any.
This section answers questions that arise from using Spring Batch with Spring Boot.
NOTE: By default, batch applications require a `DataSource` to store job details. If you
want to deviate from that, you need to implement `BatchConfigurer`. See
NOTE: By default, batch applications require a `DataSource` to store job details.
Batch autowires a single `DataSource` in your context and
uses that for processing. If you like to use a different `DataSource`, you can create
one and mark it is `@Bean` as `@BatchDataSource`. If you do so and want two data sources,
remember to create another one and mark it as `@Primary`. If you want to deviate from that,
you need to implement `BatchConfigurer`. See
{spring-batch-javadoc}/core/configuration/annotation/EnableBatchProcessing.html[The
Javadoc of `@EnableBatchProcessing`] for more details.