Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
AnnotationTransactionAspect retains reference to closed BeanFactory [SPR-7964] #12619
We have a perhaps unusual situation where we have a mixture of plain JUnit tests and Spring-powered JUnit tests (annotated to run with SpringJUnit4ClassRunner) in the same project. All of the Spring-powered tests are annotated with
all of the tests will pass.
In the order:
the tests will fail.
In the failing case, the test that is not Spring-powered performs some entirely unexpected application context initialization. As this test isn't being run with Spring's runner and isn't annotated with
Crucially, the tests that aren't Spring-powered call a method that is annotated with
To get to the point (finally!), I believe that the problem is that AnnotationTransactionAspect is being left with a reference to an out-of-date BeanFactory instance. My guess is that setting this reference to null during the cleanup processing triggered by the presence of the
I'm currently working around the failure with the following in the test class that's not Spring-powered:
1 votes, 4 watchers
Ludovic Praud commented
This one make me lose 3h to understand and to find a workaround.
To fix this, may be it should be possible to make
The work around was to do on
then do on