I have several beans in my Spring context that have state, so I\'d like to reset that state before/after unit tests.
My idea was to add a method to a helper class wh
For example:
public static List getInstantiatedSigletons(ApplicationContext ctx) { List singletons = new ArrayList(); String[] all = ctx.getBeanDefinitionNames(); ConfigurableListableBeanFactory clbf = ((AbstractApplicationContext) ctx).getBeanFactory(); for (String name : all) { Object s = clbf.getSingleton(name); if (s != null) singletons.add(s); } return singletons; }