https://docs.spring.io/spring/docs/3.0.0.M3/reference/html/ch04s04.html
Bean scopes
1、singleton
默认范围。
一个 Spring IoC 容器中只有一个 bean.
注意:这与单例设计模式不是一个概念。
用法:
2、prototype
原型模式:
就像是使用 Java 类一样,可以产生任意多个bean的实例。
用法:
下面三种只在 Web 容器中可用
1、request
Scopes a single bean definition to the life cycle of a single HTTP request;
that is each and every HTTP request will have 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 ApplicationContext.
用法:
2、session
Scopes a single bean definition to the life cycle of a HTTP Session.
- Only valid in the context of a web-aware Spring ApplicationContext.
用法:
3、global session
Scopes a single bean definition to the life cycle of a global HTTP Session.
Typically only valid when used in a port-let context.
- Only valid in the context of a web-aware Spring ApplicationContext.
用法:
-