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

@Transactional tests are executed without a transaction if transaction manager is not discovered [SPR-13895] #18469

Closed
1 task done
spring-projects-issues opened this issue Jan 26, 2016 · 1 comment
Assignees
Labels
in: test Issues in the test module type: bug A general bug
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

spring-projects-issues commented Jan 26, 2016

Sam Brannen opened SPR-13895 and commented

Status Quo

Analysis performed in conjunction with #18465 has made it apparent that there was a regression from Spring 4.0.x to 4.1 and higher.

Since Spring 4.1, if a PlatformTransactionManager is neither present nor properly detected (i.e., due to the presence of multiple transactions managers), then a test annotated with @Transactional will be executed without a transaction and without any warning.

The deviates from the behavior in Spring 4.0.x and earlier versions in which an exception was thrown in such cases, letting the user know that the transaction manager could not be retrieved.

Deliverables

  • If a test method or test class is annotated with @Transactional, ensure that an exception is thrown if the PlatformTransactionManager cannot be retrieved.

Affects: 4.1.7, 4.2 GA

Issue Links:

@spring-projects-issues
Copy link
Collaborator Author

Sam Brannen commented

Addressed in GitHub commits 6d2b9a0 and 484dd96 for Spring Framework 4.3 and 4.2.5, respectively.

Throw exception if TxMgr cannot be retrieved for @Transactional test

Prior to this commit, a @Transactional integration test would silently
be executed without a transaction if the transaction manager could not
be retrieved from the application context -- for example, it no such
bean was defined or if multiple beans were present but none satisfied
the qualifier.

This commit addresses this issue by throwing an IllegalStateException
if the PlatformTransactionManager cannot be retrieved for a
@Transactional test.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: test Issues in the test module type: bug A general bug
Projects
None yet
Development

No branches or pull requests

2 participants