Description
Marc Ludwig opened SPR-6121 and commented
Overview
We have a large number of unit/integration tests that assert behavior within our system and rely upon injection of dependencies into configurable domain objects.
These tests all work when executed individually; however, when executed within a suite (either through the IDE or Ant) certain tests fail as dependencies have not been injected into the @Configurable
objects. We have also seen dependencies that were configured for test X being injected into test Y rather than the dependencies for test Y; but I have no test case for this.
Steps to Reproduce
I have created a set of three tests -- tests 1 and 3 are basically identical. If these are executed in a suite the third test will fail as the dependency is not injected into the @Configurable
object even though it is available to the test. This only occurs if test 2 is a Spring test.
See attached zip file.
Further Resources
- Spring Test Context Caching + AspectJ @Transactional + Ehcache pain blog by Java Code Geeks
Affects: 2.5.6, 3.0.5
Reference URL: http://forum.springsource.org/showthread.php?t=77980
Attachments:
- springtest.zip (3.15 MB)
Issue Links:
- SpringContexts not properly closed after test-class is finished [SPR-11363] #15989 SpringContexts not properly closed after test-class is finished ("is duplicated by")
- TestContext framework should support one AspectJ instance per ApplicationContext [SPR-6353] #11019 TestContext framework should support one AspectJ instance per ApplicationContext
- AnnotationTransactionAspect retains reference to JpaTransactionManager from closed context [SPR-12518] #17123 AnnotationTransactionAspect retains reference to JpaTransactionManager from closed context
11 votes, 14 watchers