Spring & amp; dirtiescontext & amp; AnnotationTransactionAspect

advertisements

I use Spring 4.1.2. Junit 4 and SpringJUnit4ClassRunner with DirtiesContext.

After Spring destroys the old context and creates the new one I can see that all beans are new. BUT they are proxied by the same AnnotationTransactionAspect classes. What's interesting is that those AnnotationTransactionAspect-s(TransactionAspectSupport) have a new beanFactory! But at the same time they have old transactionManagerCache-s that caches old connections from the previous test (and those connections are already closed after spring was shut down at the end of the first test).
Why Spring does not create new AnnotationTransactionAspects?

P.S. It seems that I started facing the problem after migrating from spring 3.X to 4.X.


That was a bug in Spring. https://jira.spring.io/browse/SPR-12518 It was fixed in 4.1.4