List of usage examples for org.springframework.beans.factory.support AbstractBeanDefinition overrideFrom
public void overrideFrom(BeanDefinition other)
From source file:uk.org.ponder.rsac.support.BeanDefUtil.java
static AbstractBeanDefinition getMergedBeanDefinition(ConfigurableListableBeanFactory factory, String beanName, BeanDefinition bd) throws BeansException { if (!(bd instanceof AbstractBeanDefinition)) { throw new IllegalArgumentException("Bean definition " + beanName + " of " + bd.getClass() + " which is not descended from AbstractBeanDefinition can not be recognised"); }/* ww w .j a v a 2s . c o m*/ AbstractBeanDefinition abd = (AbstractBeanDefinition) bd; String parentName = getParentDefinitionName(abd); if (parentName == null) { return abd; } else { AbstractBeanDefinition pbd = null; if (!beanName.equals(parentName)) { pbd = getMergedBeanDefinition(factory, parentName, true); } else { if (factory.getParentBeanFactory() instanceof ConfigurableListableBeanFactory) { ConfigurableListableBeanFactory parentFactory = (ConfigurableListableBeanFactory) factory .getParentBeanFactory(); pbd = getMergedBeanDefinition(parentFactory, parentName, true); } else { throw new NoSuchBeanDefinitionException(parentName, "Parent name '" + parentName + "' is equal to bean name '" + beanName + "' - cannot be resolved without an AbstractBeanFactory parent"); } } // deep copy with overridden values pbd.overrideFrom(abd); return pbd; } }