/**
* Takes care of enforcing the relationship between exporter and importers.
*
* @param beanFactory
*/
private void enforceExporterImporterDependency(ConfigurableListableBeanFactory beanFactory) {
Object instance = null;
instance = AccessController.doPrivileged(new PrivilegedAction() {
public Object run() {
// create the service manager
ClassLoader loader = AbstractOsgiBundleApplicationContext.class.getClassLoader();
try {
Class managerClass = loader.loadClass(EXPORTER_IMPORTER_DEPENDENCY_MANAGER);
return BeanUtils.instantiateClass(managerClass);
}
catch (ClassNotFoundException cnfe) {
throw new ApplicationContextException("Cannot load class " + EXPORTER_IMPORTER_DEPENDENCY_MANAGER,
cnfe);
}
}
});
// sanity check
Assert.isInstanceOf(BeanFactoryAware.class, instance);
Assert.isInstanceOf(BeanPostProcessor.class, instance);
((BeanFactoryAware) instance).setBeanFactory(beanFactory);
beanFactory.addBeanPostProcessor((BeanPostProcessor) instance);
}
AbstractOsgiBundleApplicationContext.java 文件源码
java
阅读 22
收藏 0
点赞 0
评论 0
项目:spring-osgi
作者:
评论列表
文章目录