Skip to content

Add documentation about how to provide a custom BatchConfigurer #620

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion spring-batch-docs/asciidoc/job.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -450,8 +450,25 @@ The `@EnableBatchProcessing` works similarly to the other
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 will be used by the JobRepository.
source will be 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]
Expand Down