private void registerProduct(
ProductLine productLineAnnotation,
BeanDefinition runtimeBean,
BeanDefinition productLineBean) throws NotFoundException,
CannotCompileException, InstantiationException, IllegalAccessException, ClassNotFoundException {
Annotation targetAnnotation = getTargetAnnotation(runtimeBean, productLineAnnotation.runtimeAnnotationClass());
Class<?> productClass = productLineAnnotation.productClass();
logger.info(
"Weaving " + targetAnnotation.annotationType().getName() +
", on Product Type " + productClass.getName() +
", using Product Factory Line: " + productLineBean.getBeanClassName()
);
ProductFactoryLine productLine = (ProductFactoryLine) Class.forName(productLineBean.getBeanClassName()).newInstance();
Class<?> annotatedProductClass = weave(
productClass.getName(),
runtimeBean.getBeanClassName(),
productLine.createWeavelets(targetAnnotation)
);
Class<?> runtimeBeanClass = Class.forName(runtimeBean.getBeanClassName());
RootBeanDefinition productBean = new RootBeanDefinition(annotatedProductClass, Autowire.BY_TYPE.value(), true);
RootBeanDefinition runtimeBeanDef = new RootBeanDefinition(runtimeBeanClass, Autowire.BY_TYPE.value(), true);
productLine.beforeRegistration(targetAnnotation, productBean, runtimeBeanDef);
registry.registerBeanDefinition(annotatedProductClass.getName(), productBean);
if(productLineAnnotation.registerRuntimeBean())
registry.registerBeanDefinition(runtimeBeanClass.getName(), runtimeBeanDef);
}
ProductFactory.java 文件源码
java
阅读 21
收藏 0
点赞 0
评论 0
项目:spring-scaffy
作者:
评论列表
文章目录