if (!OsgiBundleUtils.isBundleActive(getBundle())) {
throw new ApplicationContextException("Unable to refresh application context: bundle is "
+ OsgiStringUtils.bundleStateAsString(getBundle()));
}
ConfigurableListableBeanFactory beanFactory = null;
// Prepare this context for refreshing.
prepareRefresh();
// Tell the subclass to refresh the internal bean factory.
beanFactory = obtainFreshBeanFactory();
// Prepare the bean factory for use in this context.
prepareBeanFactory(beanFactory);
try {
// Allows post-processing of the bean factory in context
// subclasses.
postProcessBeanFactory(beanFactory);
// Invoke factory processors registered as beans in the
// context.
invokeBeanFactoryPostProcessors(beanFactory);
// Register bean processors that intercept bean creation.
registerBeanPostProcessors(beanFactory);
}
catch (BeansException ex) {
// Destroy already created singletons to avoid dangling
// resources.
beanFactory.destroySingletons();
cancelRefresh(ex);
// propagate exception to the caller
throw ex;
}
}