this.parentContext = parentContext;
}
protected void doConfigure(MuleContext muleContext) throws Exception
{
Registry registry;
if (parentContext != null)
{
if (appContext instanceof ConfigurableApplicationContext)
{
registry = new SpringRegistry((ConfigurableApplicationContext) appContext, parentContext, muleContext);
}
else
{
throw new ConfigurationException(MessageFactory.createStaticMessage("Cannot set a parent context if the ApplicationContext does not implement ConfigurableApplicationContext"));
}
}
else
{
registry = new SpringRegistry(appContext, muleContext);
}
// Note: The SpringRegistry must be created before applicationContext.refresh() gets called because
// some beans may try to look up other beans via the Registry during preInstantiateSingletons().
muleContext.addRegistry(registry);
registry.initialise();
}