From 972182fc060a8075cf517ec4a9c9270b2d720678 Mon Sep 17 00:00:00 2001 From: Jay Bryant Date: Tue, 9 Feb 2021 12:29:40 -0600 Subject: [PATCH] Fix for issue #3848 Added the content that didn't get carried forward from 4.2.x. --- spring-batch-docs/asciidoc/job.adoc | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/spring-batch-docs/asciidoc/job.adoc b/spring-batch-docs/asciidoc/job.adoc index b4d2664ae1..8eba7a5801 100644 --- a/spring-batch-docs/asciidoc/job.adoc +++ b/spring-batch-docs/asciidoc/job.adoc @@ -438,6 +438,27 @@ created in addition to a number of beans made available to be autowired: The core interface for this configuration is the `BatchConfigurer`. The default implementation provides the beans mentioned above and requires a `DataSource` as a bean within the context to be provided. This data source is used by the JobRepository. +You can customize any of these beans +by creating a custom implementation of the `BatchConfigurer` interface. +Typically, extending the `DefaultBatchConfigurer` (which is provided if a +`BatchConfigurer` is not found) and overriding the required getter is sufficient. +However, implementing your own from scratch may be required. The following +example shows how to provide a custom transaction manager: + +==== +[source, java] +---- +@Bean +public BatchConfigurer batchConfigurer() { + return new DefaultBatchConfigurer() { + @Override + public PlatformTransactionManager getTransactionManager() { + return new MyTransactionManager(); + } + }; +} +---- +==== [NOTE] ====