Skip to content

GH-5388: Warn about mismatched JobRepository DataSource - #5437

Open
DragonFSKY wants to merge 1 commit into
spring-projects:mainfrom
DragonFSKY:fix/5388-datasource-transaction-manager
Open

GH-5388: Warn about mismatched JobRepository DataSource#5437
DragonFSKY wants to merge 1 commit into
spring-projects:mainfrom
DragonFSKY:fix/5388-datasource-transaction-manager

Conversation

@DragonFSKY

@DragonFSKY DragonFSKY commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Closes #5388.

Add a warning during JdbcJobRepositoryFactoryBean initialization when a ResourceTransactionManager exposes a different DataSource from the repository. The check is best-effort and reuses Spring's resource comparison; unsupported transaction managers are left unchanged. A TransactionAwareDataSourceProxy is compared using its target to avoid false warnings.

One focused test verifies the mismatch warning, the valid proxy case, and unsupported transaction managers.

Tests:

  • ./mvnw --no-transfer-progress -pl spring-batch-core -Dtest=JdbcJobRepositoryFactoryBeanTests test
  • ./mvnw --no-transfer-progress --quiet -pl spring-batch-core test (819 tests, 0 failures/errors)
  • git diff --check

Signed-off-by: Dongliang Xie <dragonfsky@gmail.com>
@DragonFSKY
DragonFSKY force-pushed the fix/5388-datasource-transaction-manager branch from d973c9a to 3f1f232 Compare August 26, 2026 02:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Help users to avoid mismatched DataSource and TransactionManager pairs

1 participant