小菜鸟学 Spring-bean scope (一)

this information below just for study record of mine.

默认情况下:Spring 创建singleton bean 以便于错误能够被发现。
延迟加载:延迟加载可以使bean 在被需要的时候实例化

Bean Scope
singleton :    Scopes a single bean definition to a single object instance per Spring IoC container.
To put it another way, when you define a bean definition and it is scoped as a singleton, the Spring IoC container creates exactly one instance of the object defined by that bean definition. This single instance is stored in a cache of such singleton beans, and all subsequent requests and references for that named bean return the cached object.



prototype:    Scopes a single bean definition to any number of object instances
request:         Scopes a single bean definition to the lifecycle of a single HTTP request
session:  Scopes a single bean definition to the lifecycle of an HTTP Session
global sessionScopes a single bean definition to the lifecycle of a global HTTP Session


if there are some copyright or problem happened ,please contact  me.
zbwork000@163.com



posted @ 2013-09-02 09:29  梦见舟  阅读(115)  评论(0编辑  收藏  举报