从Spring Bean的存储类AbstractBeanDefinition来了解:
类中属性 | 类型 | XML元素 | 取值 |
---|---|---|---|
scope | String | scope | prototype:非单例 singleton:采用单例模式 |
autowireMode | int | autowire | 自动装配模式,注意说的是怎么装配自身的属性 byName:根据名称自动装配 byType:根据类型自动装配 constructor:通过构造方法自动装配 default:跟随上级属性 none:不支持自动装配 |
abstractFlag | boolean | abstract | 是否可实例化,例如部分父Bean不实例化 |
lazyInit | boolean | lazy-init | 是否延迟实例化,只对单例bean有效 false:单例Bean在applicationContext加载后进行实例化 true:单例Bean不立即实例化,减少初始化耗时。第一次getBean时实例化 default: |
dependencyCheck | int | ? | ? |
dependsOn | String[] | depends-on | 增加了对某些Bean的依赖,可配置多个 |
autowireCandidate | boolean | autowire-candidate | false:本身不会加入Autowire的选择表中 |
primary | boolean | primary | 多个Bean同时满足要求时,优先选择本Bean进行注入 |
nonPublicAccessAllowed | boolean | ? | 是否允许访问非公开的构造器和方法 |
lenientConstructorResolution | boolean | ? | ? |
constructorArgumentValues | ConstructorArgumentValues | 标签constructor-arg | 构造方法的入参 |
propertyValues | MutablePropertyValues | 标签property | 设置参数值 |
methodOverrides | MethodOverrides | ? | ? |
factoryBeanName | String | factory-bean | 产生该Bean的工厂Bean |
factoryMethodName | String | factory-method | 工厂方法名称,需要是静态方法 |
initMethodName | String | init-method | 初始化方法名称 |
destroyMethodName | String | destroy-method | 销毁方法名称 |
enforceInitMethod | boolean | ? | 强制执行初始化方法 |
enforceDestroyMethod | boolean | ? | 强制执行销毁方法 |
synthetic | boolean | ? | ? |
role | int | ? | ? |
description | String | 标签description | 描述信息 |
resource | Resource | ? | ? |
附:“?”表示不知道什么玩意,或者不能设置。