Scope | Description |
---|---|
(Default) Scopes a single bean definition to a single object instance for each Spring IoC container. |
|
Scopes a single bean definition to any number of object instances. |
|
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 |
|
Scopes a single bean definition to the lifecycle of a |
<bean id="user3" class="com.wt.pojo.User" scope="prototype"> <constructor-arg name="name" value="gg"/> <constructor-arg name="age" value="45"/> </bean>
spring 默认是单例机制
原型模式:每次从容器中get的时候,都会获取新的对象