For example, I have created a slew of 'test-my-service' Objects in my Spring config and each Object has data that concerns a contrived test scenario. Currently I am manually editing the Spring config every time I want to run a new scenario, or a List of scenarios. Is there a way I could add a prefix to a bean name, and then load all of the beans with that prefix (or suffix) into a List or Array? Something like....
<bean name="env1-test1"/>
<bean name="env2-test1"/>
This is the code that I ended up writing. I wasn't able to get the beanFactory Object initialized from the example that I accepted earlier:
String[] beanNames = context.getBeanNamesForType(Inputs.class);
for (String beanName : beanNames) {
if (beanName.startsWith("env")) {
System.out.println("Found a bean of type " + Inputs.class.getName());
Inputs bean = (Inputs)context.getBean(beanName);
doTest(bean);
}
}