Add documentation about multiple transaction managers sharing same resource - #36688
Closed
Arbaz4Sayyad wants to merge 1 commit into
Closed
Conversation
…source Addresses spring-projects#36684 by clarifying that when multiple DataSourceTransactionManager instances are configured with the same DataSource, transactions created by one manager can participate in existing transactions created by another manager. Changes: - Add Javadoc to DataSourceTransactionManager explaining the behavior - Add reference documentation section with code example
Member
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #36684
This PR adds documentation to clarify the behavior when multiple DataSourceTransactionManager instances are configured with the same underlying DataSource.
Changes
Javadoc Update
Added a new paragraph to DataSourceTransactionManager class Javadoc explaining that:
When multiple transaction managers share the same DataSource, transactions created by one manager can participate in existing transactions created by another manager
This behavior occurs because transaction synchronization is based on the resource itself, not the transaction manager instance
Example: if tm1 starts a transaction and tm2 (with same DataSource) begins a transaction with PROPAGATION_REQUIRED, it will join the existing transaction
Reference Documentation Update
Added a new section "Multiple Transaction Managers with the Same Resource" in strategies.adoc that includes:
Explanation of the coordination behavior
Code example demonstrating two transaction managers sharing the same DataSource
Clarification that coordination happens through TransactionSynchronizationManager
Use case description for when this behavior is useful
Testing
No code changes required - this is a documentation-only update that clarifies existing behavior.