Problem: We have a test which requires the ApplicationContext to be reset before and after running. We got BEFORE_CLASS and AFTER_CLASS ClassMode options.

Current workaround: Writing a customer listener as described here: https://stackoverflow.com/questions/39277040/make-applicationcontext-dirty-before-and-after-test-class

Would it be possible to add an additional mode to do both for that class? Thank you! (Happy to look into it in my own time as well)

Comment From: snicoll

We have a test which requires the ApplicationContext to be reset before and after running. We got BEFORE_CLASS and AFTER_CLASS ClassMode options.

Thanks for the suggestion but I don't really understand what that means. If the context is marked dirty after the test, it's closed and removed from the cache. I don't see how doing that again before the next test starts would give you anything. Can you share an example that shows concretely how that new feature would be useful? You can attach a zip to to this issue or push the code to a separate GitHub repository.

Comment From: spring-projects-issues

If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.

Comment From: sbrannen

This also somewhat a:

  • duplicate of #18295