public class MicrocontainerLoaderImpl extends AbstractBeanFactoryLoader
{
protected BeanFactory createBeanFactory(String defaultName, Resource resource)
{
ConfigurableApplicationContext applicationContext = new NamedXmlApplicationContext(defaultName, resource, false);
MicrocontainerConfigurer microcontainerPostProcessor = new MicrocontainerConfigurer();
Locator locator = new NullLocator();
KernelController controller = getKernelController();
Kernel kernel = getKernel();
if (controller != null)
{
locator = new ControllerLocator(controller);
}
else if (kernel != null)
{
locator = new KernelLocator(kernel);
}
microcontainerPostProcessor.setLocator(locator);
applicationContext.addBeanFactoryPostProcessor(microcontainerPostProcessor);
applicationContext.refresh();
return applicationContext;
}