Skip to content
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

Remove the unconditional exposure of the transaction manager as a bean #3981

Closed
wants to merge 1 commit into from

Conversation

fmbenhassine
Copy link
Contributor

This PR addresses Issue #816. It removes the unconditional exposure of the transaction manager as a bean in the application context. The transaction manager is still taken from the BatchConfigurer and set where needed (ie on JobRepository and StepBuilderFactory) as previously done, but is not exposed anymore as a bean to prevent any clash with a user-defined transaction manager if any.

If no transaction manager is provided, a DataSourceTransactionManager will be configured by default as required by batch (without being exposed as a bean). Note that a DataSource will be mandatory starting from v5, so this seems a reasonable default to me.

Moreover, this change makes the Java config style consistent with the XML config style, where the transaction manager is not exposed as a bean by the <batch:*> namespace.

This commit removes the unconditional exposure of the transaction
manager as a bean in the application context. The transaction manager
is still taken from the BatchConfigurer and set where needed (ie on
JobRepository and StepBuilderFactory) as previously done,
but is not exposed anymore as a bean to prevent any clash with a user
defined transaction manager.

If no transaction manager is provided, a DataSourceTransactionManager
will be configured by default as required by batch (without being exposed
as a bean).

Issue spring-projects#816
@fmbenhassine
Copy link
Contributor Author

Rebased and merged as 0d32825.

@fmbenhassine fmbenhassine deleted the GH-816 branch November 22, 2021 15:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

PlatformTransactionManager bean is exposed unconditionally [BATCH-2788]
1 participant