Skip to content

Commit 7ce3408

Browse files
fmbenhassinemminella
authored andcommitted
Add documentation about how to provide a custom BatchConfigurer
Resolves BATCH-2724
1 parent a68d700 commit 7ce3408

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

spring-batch-docs/asciidoc/job.adoc

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -450,8 +450,25 @@ The `@EnableBatchProcessing` works similarly to the other
450450
The core interface for this configuration is the `BatchConfigurer`.
451451
The default implementation provides the beans mentioned above and requires a
452452
`DataSource` as a bean within the context to be provided. This data
453-
source will be used by the JobRepository.
453+
source will be used by the JobRepository. You can customize any of these beans
454+
by creating a custom implementation of the `BatchConfigurer` interface.
455+
Typically, extending the `DefaultBatchConfigurer` (which is provided if a
456+
`BatchConfigurer` is not found) and overriding the required getter is sufficient.
457+
However, implementing your own from scratch may be required. The following
458+
example shows how to provide a custom transaction manager:
454459

460+
[source, java]
461+
----
462+
@Bean
463+
public BatchConfigurer batchConfigurer() {
464+
return new DefaultBatchConfigurer() {
465+
@Override
466+
public PlatformTransactionManager getTransactionManager() {
467+
return new MyTransactionManager();
468+
}
469+
};
470+
}
471+
----
455472

456473

457474
[NOTE]

0 commit comments

Comments
 (0)