杀死Spring - BeanFactory中的AbstractAutowireCapatableBeanFactory
由前面博客我们知道AbstractAutowireCapableBeanFactory的继承关系如下:
从两个方面域和方法来分析AbstractAutowireCapableBeanFactory
一:域
//实例化策略
private InstantiationStrategy instantiationStrategy;
//是否允许循环依赖
private boolean allowCircularReferences;
//是否允许
private boolean allowRawInjectionDespiteWrapping;
//忽略的依赖类型
private final Set ignoredDependencyTypes;
//忽略的依赖接口
private final Set ignoredDependencyInterfaces;
//FactoryBean的实例缓存
private final Map factoryBeanInstanceCache;
//过滤的属性描述缓存
private final Map filteredPropertyDescriptorsCache;
二:方法
2.1:
public void copyConfigurationFrom(ConfigurableBeanFactory otherFactory) {
//调用父类(AbstractBeanFactory)的copyConfigurationFrom
super.copyConfigurationFrom(otherFactory);
//如果otherFactory是DefaultListableBeanFactory或其子类的实例
//将otherFactory的allowBeanDefinitionOverriding和allowBeanDefinitionOverriding赋值给this
if (otherFactory instanceof DefaultListableBeanFactory) {
DefaultListableBeanFactory otherListableFactory = (DefaultListableBeanFactory)otherFactory;
this.allowBeanDefinitionOverriding = otherListableFactory.allowBeanDefinitionOverriding;
this.allowEagerClassLoading = otherListableFactory.allowEagerClassLoading;
}
}