public PropertyValues postProcessPropertyValues(PropertyValues pvs, PropertyDescriptor[] pds, Object bean,
String beanName) throws BeansException {
MutablePropertyValues newprops = new MutablePropertyValues(pvs);
for (PropertyDescriptor pd : pds) {
ServiceReference s = hasServiceProperty(pd);
if (s != null && !pvs.contains(pd.getName())) {
try {
if (logger.isDebugEnabled())
logger.debug("Processing annotation [" + s + "] for [" + beanName + "." + pd.getName() + "]");
FactoryBean importer = getServiceImporter(s, pd.getWriteMethod(), beanName);
// BPPs are created in stageOne(), even though they are run in stageTwo(). This check means that
// the call to getObject() will not fail with ServiceUnavailable. This is safe to do because
// ServiceReferenceDependencyBeanFactoryPostProcessor will ensure that mandatory services are
// satisfied before stageTwo() is run.
if (bean instanceof BeanPostProcessor) {
ImporterCallAdapter.setCardinality(importer, Availability.OPTIONAL);
}
newprops.addPropertyValue(pd.getName(), importer.getObject());
}
catch (Exception e) {
throw new FatalBeanException("Could not create service reference", e);
}
}
}
return newprops;
}
ServiceReferenceInjectionBeanPostProcessor.java 文件源码
java
阅读 27
收藏 0
点赞 0
评论 0
项目:gemini.blueprint
作者:
评论列表
文章目录