(一)对于bean标签的id与name属性:都是标注bean的名字,二者主要的区别就是:name属性可以添加一些特殊字符。
(二)指定bean的作用域使用scope属性:属性值如下
Scope | Description |
---|---|
(Default) Scopes a single bean definition to a single object instance per Spring IoC container. (spring的默认作用域,每次使用同一个实例) | |
Scopes a single bean definition to any number of object instances.(每次都产生一个新的实例)(struts的Action的作用域默认) | |
Scopes a single bean definition to the lifecycle of a single HTTP request; that is, each HTTP request has its own instance of a bean created off the back of a single bean definition. Only valid in the context of a web-aware Spring | |
Scopes a single bean definition to the lifecycle of an HTTP | |
Scopes a single bean definition to the lifecycle of a global HTTP | |
Scopes a single bean definition to the lifecycle of a | |
Scopes a single bean definition to the lifecycle of a |