public ConfigurableApplicationContext newApplicationContext(
ApplicationContext parent, final ModuleDefinition moduleDefinition,
ClassLoader classLoader) {
Bundle bundle = findBundle(moduleDefinition);
final ImpalaOsgiApplicationContext applicationContext = newApplicationContext(parent, moduleDefinition);
final BundleContext bc = bundle.getBundleContext();
applicationContext.setBundleContext(bc);
final Resource[] springConfigResources = getSpringConfigResources(moduleDefinition, classLoader);
final ClassLoader newClassLoader = newClassLoader(moduleDefinition, parent);
applicationContext.setClassLoader(newClassLoader);
applicationContext.setConfigResources(springConfigResources);
applicationContext.setDisplayName(ModuleLoaderUtils.getDisplayName(moduleDefinition, applicationContext));
DelegatedExecutionOsgiBundleApplicationContext dc = ObjectUtils.cast(applicationContext, DelegatedExecutionOsgiBundleApplicationContext.class);
dc.startRefresh();
return applicationContext;