Our existing Spring Boot integration setup was using @DirtiesContext to rebuild the entire bean pool in-between different test methods.
This was fairly slow, and so we started working with beans that could be "refreshed" or torn down/rebuild internally without re-creating the instance.
The problem is that only some beans support this. If we control UsersBean, we can implement a UsersBean.refresh() method and call it in our @After method.
But if we have existing beans/classes that don't support refreshing, or we don't control, how can we conditionally indicate that certain beans need to be dirtied/rebuilt after a specific test?
Or more succinctly: Is there a way to mark as dirty a subsection of your bean pool, for rebuilding, at the end of a test method?