public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
final KernelDeploymentXmlDescriptor kdXmlDescriptor = phaseContext.getDeploymentUnit().getAttachment(KernelDeploymentXmlDescriptor.ATTACHMENT_KEY);
if(kdXmlDescriptor == null)
return;
final Module module = phaseContext.getDeploymentUnit().getAttachment(Attachments.MODULE);
if(module == null)
throw new DeploymentUnitProcessingException("Failed to get module attachment for " + phaseContext.getDeploymentUnit());
final DeploymentReflectionIndex index = phaseContext.getAttachment(Attachments.REFLECTION_INDEX);
final List<BeanMetaDataConfig> beanConfigs = kdXmlDescriptor.getBeans();
final ServiceTarget serviceTarget = phaseContext.getServiceTarget();
for(final BeanMetaDataConfig beanConfig : beanConfigs) {
final String className = beanConfig.getBeanClass();
try {
addBean(serviceTarget, beanConfig, Class.forName(className, false, module.getClassLoader()), index);
} catch (ClassNotFoundException e) {
throw new DeploymentUnitProcessingException("Bean class " + className + " not found", e);
}
}
}