AbstractBeanDefinition.java
private volatile Object beanClass;
//bean的作用范圍跳仿,對應(yīng)bean屬性的scope
//public static final String SCOPE_DEFAULT = "";
private String scope = SCOPE_DEFAULT;
//是否是單例谎痢,來自bean屬性的scpoe
private boolean singleton = true;
//是否是原型豆励,來自bean屬性的scope
private boolean prototype = false;
//是否是抽象逆日,對應(yīng)bean屬性的abstract
private boolean abstractFlag = false;
//是否延遲加載挚币,對應(yīng)bean屬性lazy-init
private boolean lazyInit = false;
//自動注入模式,對應(yīng)bean屬性的autowire
//int AUTOWIRE_NO = 0;;
private int autowireMode = AUTOWIRE_NO;
//以來檢查,spring3.0后啟用這個屬性
private int dependencyCheck = DEPENDENCY_CHECK_NONE;
//用來表示一個bean的實例化依靠另外一個bean先實例化,對應(yīng)bean屬性depend-on
private String[] dependsOn;
//autowire-candidate屬性設(shè)置為false器瘪,這樣容器在查找自動裝配對象時候,將不考慮該bean绘雁,也就是他不會被考慮作為其他bean自動裝配的候選者橡疼,但是該bean本身還是可以使自動裝配來注入其他bean的
private boolean autowireCandidate = true;
//自動裝配時當(dāng)出現(xiàn)多個bean候選者時,將作為首選庐舟,對應(yīng)bean屬性的primary
private boolean primary = false;
//用于記錄Qualifier欣除,對應(yīng)子元素的qualifiers,當(dāng)自動注入的時候有相同的類型的bean時候挪略,可以用Qualifier來指定注入的bean
private final Map<String, AutowireCandidateQualifier> qualifiers =
new LinkedHashMap<String, AutowireCandidateQualifier>(0);
//允許訪問非公開的構(gòu)造器和方法历帚,程序可以設(shè)置
private boolean nonPublicAccessAllowed = true;
//是否以一種寬松的模式解析構(gòu)造函數(shù),默認(rèn)為true
/**
如果為false瘟檩,則在如下情況
interface MyTest{}
class MyTestImpl implements MyTest{}
class Main{
Main(MyTest i){}
Main(MyTestImpl i){}
}
拋出異常抹缕,因為Spring無法準(zhǔn)確定位那個構(gòu)造器
*/
private boolean lenientConstructorResolution = true;
//記錄構(gòu)造函數(shù)注入屬性 澈蟆,對應(yīng)bean屬性construct-arg
private ConstructorArgumentValues constructorArgumentValues;
//普通屬性集合
private MutablePropertyValues propertyValues;
//方法重寫的持有者墨辛,記錄lookup-method,replace-method元素
private MethodOverrides methodOverrides = new MethodOverrides();
/* 對應(yīng)bean屬性factory-bean
* 用法
*<bean id=''instanceFactoryBean" class="com.MyTestBean">
*<bean id=''currentTime" factory-bean="instanceFactoryBean" factory-method="createTime" >
*/
private String factoryBeanName;
//對應(yīng)bean屬性factory-method
private String factoryMethodName;
//初始化方法趴俘,對應(yīng)bean屬性init-method
private String initMethodName;
//銷毀方法睹簇。對應(yīng)bean屬性destroy-method
private String destroyMethodName;
//是否執(zhí)行init-method,程序設(shè)置
private boolean enforceInitMethod = true;
//是否執(zhí)行destroy-method寥闪,程序設(shè)置
private boolean enforceDestroyMethod = true;
//是否是用戶定義的而不是應(yīng)用程序本身定義太惠,創(chuàng)建AOP時候為true,程序設(shè)置
private boolean synthetic = false;
//定義這個bean的應(yīng)用疲憋,APPLICATION:用戶凿渊,INFARSTRUCTURE;
private int role = BeanDefinition.ROLE_APPLICATION;
//bean的描述信息
private String description;
//這個bean定義的資源
private Resource resource;