Modify @ConditionalOnMissingBean
of transactionManager
in JdbcTransactionManagerConfiguration
#35261
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.
In
JdbcTransactionManagerConfiguration
, thetransactionManager
bean is registered if there is no bean ofTransactionManager
types. However, the autoconfiguration is responsible for jdbc transactionmanagers related withPlatformTransactionManager
, notReactiveTransactionManager
. For now, with an existingReactiveTransactionManager
, this autoconfiguration doesn't register the expectable transactionmanager. I think the condition of thetransactionManager()
bean method should be modified.I added a test related with it, and fixed one existing test because it didn't configure
DataSourceAutoConfiguration
, which made the test vacuously true.After I made this PR, I checked the issue #22851 which is opposite. It said like below.
I also agreed with it, but I made this PR because when I develop a spring batch application with jdbc for
JobRepository
and r2dbc for main service and repository logic, I figured out this condition of the autoconfiguration prevents registering the required jdbc transactionmanager. Please give your opinion about this and I can close this PR or modify PR only for fixing the existing test.