1.alias标签使用:在实际业务场景可能会需要同一个类型的bean要注入多个,那就需要指定一个别名
2.解析标签、bean、beans、import、alias标签到BeanDefinition注册到BeanRegistry上
3.BeanDefiniton的UML
4.bean标签lookup属性的使用
5.bean标签replace属性的使用
6.AbstractBeanDefinition.java
//beanClass
private volatile Object beanClass;
//bean元素的scope
private String scope = SCOPE_DEFAULT;
private boolean abstractFlag = false;
private boolean lazyInit = false;
//自动注入模式
private int autowireMode = AUTOWIRE_NO;
private int dependencyCheck = DEPENDENCY_CHECK_NONE;
//实例该bean依赖的其他bean对应bean元素的depend-on
private String[] dependsOn;
//设置该属性后,该bean将不会考虑作为其他bean自动装配的候选
private boolean autowireCandidate = true;
//自动装配出现多个bean候选者,primary为true的将作为首选有点像@Primary
private boolean primary = false;
private final Map<String, AutowireCandidateQualifier> qualifiers =
new LinkedHashMap<String, AutowireCandidateQualifier>(0);
//允许访问非公开的构造器和方法
private boolean nonPublicAccessAllowed = true;
/**
* 是否以宽松方式解析构造函数
*/
private boolean lenientConstructorResolution = true;
//bean元素的factory-bean
private String factoryBeanName;
//bean元素的factory-method
private String factoryMethodName;
//构造函数参数
private ConstructorArgumentValues constructorArgumentValues;
//普通属性
private MutablePropertyValues propertyValues;
//look-method、replaced-method方法
private MethodOverrides methodOverrides = new MethodOverrides();
//init-method
private String initMethodName;
private String destroyMethodName;
//是否执行initMethod
private boolean enforceInitMethod = true;
private boolean enforceDestroyMethod = true;
//合成的
private boolean synthetic = false;
//谁定义的这个bean APPLICATION用户INFRASTUCTURE内部使用
//SUPPORT一些较大配置的一部分,通常是外部配置
private int role = BeanDefinition.ROLE_APPLICATION;
private String description;
//bean定义对应的资源
private Resource resource;
7.解析每个import标签、bean标签、import标签、beans标签完成后会通知监听器