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 @ContextConfiguration at 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

Comment From: spring-projects-issues

Sam Brannen commented

This issue is closely related to #16647.

Comment From: spring-projects-issues

Sam Brannen commented

Dziesio,

What do you mean by the following?

i.e. using BeanFactoryPostProcessor for that test class

Comment From: spring-projects-issues

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.

Comment From: denniseffing

We have a similar (small) issue where this would have been helpful as well.

Comment From: ian4hu

Did some one tried the @DirtiesContext annotation?

Comment From: sbrannen

Please note that I provided a DirtyContextBeforeAndAfterClassTestExecutionListener workaround on Stack Overflow.