-
Couldn't load subscription status.
- Fork 38.8k
Closed as not planned
Closed as not planned
Copy link
Labels
in: coreIssues in core modules (aop, beans, core, context, expression)Issues in core modules (aop, beans, core, context, expression)in: testIssues in the test moduleIssues in the test modulestatus: duplicateA duplicate of another issueA duplicate of another issue
Description
Running two tests with different application contexts will cause the same aspectj AbstractTransactionAspect instance to be reused, (but setBeanFactory is called also for the second test context).
Beceause TransactionAspectSupport.transactionManagerCache is not cleared for the second test context, the transactionManager from first test is used, which can lead to issues.
Created example application where first test closes the db connection, causing failure in second test (if run afterwards in same jvm).
I'm not sure what correct solution can be:
- clearing
transactionManagerCacheonTransactionAspectSupport.setBeanFactorycan help, but would this be safe when running tests in parallel? if first test context is later reused, wouldsetBeanFactorybe called again? - I think the real issue is that same AbstractTransactionAspect instance is reused between test contexts, and we should have separate instances
spring-aspects-issue-cachedtm.zip
Metadata
Metadata
Assignees
Labels
in: coreIssues in core modules (aop, beans, core, context, expression)Issues in core modules (aop, beans, core, context, expression)in: testIssues in the test moduleIssues in the test modulestatus: duplicateA duplicate of another issueA duplicate of another issue