Ok, so I got it to work, but it's REALLY ugly. This works:
Code:
GenericApplicationContext firstCtx = new GenericApplicationContext();
XmlBeanDefinitionReader xmlReader = new XmlBeanDefinitionReader(firstCtx );
xmlReader.loadBeanDefinitions("applicationContext.xml");
GenericApplicationContext ctx = new GenericApplicationContext();
AnnotatedBeanDefinitionReader annotatedReader = new AnnotatedBeanDefinitionReader(ctx);
annotatedReader.register(SomeConfigClass.class);
ctx.refresh();
for (String currBeanName : firstCtx.getBeanDefinitionNames())
{
if (!ctx.containsBeanDefinition(currBeanName))
{
ctx.registerBeanDefinition(currBeanName, firstCtx.getBeanDefinition(currBeanName));
}
}
I'd still prefer to use a cleaner way to do this, if one exists. Suggestions?