|
|
@ -145,8 +145,7 @@ public abstract class AbstractAutowireCapableBeanFactory extends AbstractBeanFac |
|
|
|
private final Set<Class<?>> ignoredDependencyInterfaces = new HashSet<>(); |
|
|
|
private final Set<Class<?>> ignoredDependencyInterfaces = new HashSet<>(); |
|
|
|
|
|
|
|
|
|
|
|
/** Cache of unfinished FactoryBean instances: FactoryBean name --> BeanWrapper */ |
|
|
|
/** Cache of unfinished FactoryBean instances: FactoryBean name --> BeanWrapper */ |
|
|
|
private final Map<String, BeanWrapper> factoryBeanInstanceCache = |
|
|
|
private final Map<String, BeanWrapper> factoryBeanInstanceCache = new ConcurrentHashMap<>(16); |
|
|
|
new ConcurrentHashMap<>(16); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** Cache of filtered PropertyDescriptors: bean Class -> PropertyDescriptor array */ |
|
|
|
/** Cache of filtered PropertyDescriptors: bean Class -> PropertyDescriptor array */ |
|
|
|
private final ConcurrentMap<Class<?>, PropertyDescriptor[]> filteredPropertyDescriptorsCache = |
|
|
|
private final ConcurrentMap<Class<?>, PropertyDescriptor[]> filteredPropertyDescriptorsCache = |
|
|
@ -536,7 +535,7 @@ public abstract class AbstractAutowireCapableBeanFactory extends AbstractBeanFac |
|
|
|
} |
|
|
|
} |
|
|
|
catch (Throwable ex) { |
|
|
|
catch (Throwable ex) { |
|
|
|
throw new BeanCreationException(mbd.getResourceDescription(), beanName, |
|
|
|
throw new BeanCreationException(mbd.getResourceDescription(), beanName, |
|
|
|
"Post-processing of bean type [" + beanType.getName() + "] failed", ex); |
|
|
|
"Post-processing of merged bean definition failed", ex); |
|
|
|
} |
|
|
|
} |
|
|
|
mbd.postProcessed = true; |
|
|
|
mbd.postProcessed = true; |
|
|
|
} |
|
|
|
} |
|
|
@ -721,8 +720,7 @@ public abstract class AbstractAutowireCapableBeanFactory extends AbstractBeanFac |
|
|
|
paramNames = pnd.getParameterNames(factoryMethod); |
|
|
|
paramNames = pnd.getParameterNames(factoryMethod); |
|
|
|
} |
|
|
|
} |
|
|
|
ConstructorArgumentValues cav = mbd.getConstructorArgumentValues(); |
|
|
|
ConstructorArgumentValues cav = mbd.getConstructorArgumentValues(); |
|
|
|
Set<ConstructorArgumentValues.ValueHolder> usedValueHolders = |
|
|
|
Set<ConstructorArgumentValues.ValueHolder> usedValueHolders = new HashSet<>(paramTypes.length); |
|
|
|
new HashSet<>(paramTypes.length); |
|
|
|
|
|
|
|
Object[] args = new Object[paramTypes.length]; |
|
|
|
Object[] args = new Object[paramTypes.length]; |
|
|
|
for (int i = 0; i < args.length; i++) { |
|
|
|
for (int i = 0; i < args.length; i++) { |
|
|
|
ConstructorArgumentValues.ValueHolder valueHolder = cav.getArgumentValue( |
|
|
|
ConstructorArgumentValues.ValueHolder valueHolder = cav.getArgumentValue( |
|
|
@ -952,12 +950,9 @@ public abstract class AbstractAutowireCapableBeanFactory extends AbstractBeanFac |
|
|
|
* @param mbd the merged bean definition for the bean |
|
|
|
* @param mbd the merged bean definition for the bean |
|
|
|
* @param beanType the actual type of the managed bean instance |
|
|
|
* @param beanType the actual type of the managed bean instance |
|
|
|
* @param beanName the name of the bean |
|
|
|
* @param beanName the name of the bean |
|
|
|
* @throws BeansException if any post-processing failed |
|
|
|
|
|
|
|
* @see MergedBeanDefinitionPostProcessor#postProcessMergedBeanDefinition |
|
|
|
* @see MergedBeanDefinitionPostProcessor#postProcessMergedBeanDefinition |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
protected void applyMergedBeanDefinitionPostProcessors(RootBeanDefinition mbd, Class<?> beanType, String beanName) |
|
|
|
protected void applyMergedBeanDefinitionPostProcessors(RootBeanDefinition mbd, Class<?> beanType, String beanName) { |
|
|
|
throws BeansException { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (BeanPostProcessor bp : getBeanPostProcessors()) { |
|
|
|
for (BeanPostProcessor bp : getBeanPostProcessors()) { |
|
|
|
if (bp instanceof MergedBeanDefinitionPostProcessor) { |
|
|
|
if (bp instanceof MergedBeanDefinitionPostProcessor) { |
|
|
|
MergedBeanDefinitionPostProcessor bdp = (MergedBeanDefinitionPostProcessor) bp; |
|
|
|
MergedBeanDefinitionPostProcessor bdp = (MergedBeanDefinitionPostProcessor) bp; |
|
|
@ -1000,12 +995,9 @@ public abstract class AbstractAutowireCapableBeanFactory extends AbstractBeanFac |
|
|
|
* @param beanClass the class of the bean to be instantiated |
|
|
|
* @param beanClass the class of the bean to be instantiated |
|
|
|
* @param beanName the name of the bean |
|
|
|
* @param beanName the name of the bean |
|
|
|
* @return the bean object to use instead of a default instance of the target bean, or {@code null} |
|
|
|
* @return the bean object to use instead of a default instance of the target bean, or {@code null} |
|
|
|
* @throws BeansException if any post-processing failed |
|
|
|
|
|
|
|
* @see InstantiationAwareBeanPostProcessor#postProcessBeforeInstantiation |
|
|
|
* @see InstantiationAwareBeanPostProcessor#postProcessBeforeInstantiation |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
protected Object applyBeanPostProcessorsBeforeInstantiation(Class<?> beanClass, String beanName) |
|
|
|
protected Object applyBeanPostProcessorsBeforeInstantiation(Class<?> beanClass, String beanName) { |
|
|
|
throws BeansException { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (BeanPostProcessor bp : getBeanPostProcessors()) { |
|
|
|
for (BeanPostProcessor bp : getBeanPostProcessors()) { |
|
|
|
if (bp instanceof InstantiationAwareBeanPostProcessor) { |
|
|
|
if (bp instanceof InstantiationAwareBeanPostProcessor) { |
|
|
|
InstantiationAwareBeanPostProcessor ibp = (InstantiationAwareBeanPostProcessor) bp; |
|
|
|
InstantiationAwareBeanPostProcessor ibp = (InstantiationAwareBeanPostProcessor) bp; |
|
|
|