spring-framework
spring-framework copied to clipboard
Support 'throw-away' context for a test class [SPR-13722]
Grzegorz Poznachowski opened SPR-13722 and commented
It would be nice to have an option for marking a single test class to get a fresh context and not use a cached context at all (i.e. using BeanFactoryPostProcessor for that test class).
Affects: 4.2.3
Reference URL: http://stackoverflow.com/questions/26931236/is-it-possble-to-reset-spring-tests-context-cache-before-a-test-suite-runs-not
Issue Links:
- #16647 Support
@ContextConfigurationat method level - #9309 Load dedicated child ApplicationContext for test instance in the TestContext framework
- #12710 Limit size of context cache in the TestContext framework
1 votes, 3 watchers
Sam Brannen commented
What do you mean by the following?
i.e. using
BeanFactoryPostProcessorfor that test class
Grzegorz Poznachowski commented
In some of my tests I'm using BeanFactoryPostProcessor to modify bean declarations. For such cases I would find throw-away context useful.
We have a similar (small) issue where this would have been helpful as well.
Did some one tried the @DirtiesContext annotation?
Please note that I provided a DirtyContextBeforeAndAfterClassTestExecutionListener workaround on Stack Overflow.