The default is a single case mode, that is, scope= "singleton". The scope also has prototype, request, session, global session scope. Scope= "Prototype" in many cases
@scope default is a single case mode (singleton)
If you need to set the words @scope ("prototype")
1.singleton single case mode,
Global has and only one instance
2.prototype prototype mode,
A new instance is available each time the bean is fetched
3.request request indicates that a new bean will be generated for each HTTP demand, and that the bean is valid only within the current HTTP requests, configuration instance: request, session, global The session is used with the following configuration in the initialization Web Web.xml: If you are using a Web container of servlet 2.4 and above, Then you only need to add the following contextlistener to the XML declaration file web.xml of the Web application:
<web-app> ...
<listener>
<listener-class>org.springframework.web.context.request.requestcontextlistener</ Listener-class>
</listener> ...
</web-app>
4.session
The session scope indicates that a new bean is generated for each HTTP request, and that the bean is valid only within the current HTTP sessions
The
5.global session Global session scope is similar to the standard HTTP session scope, but it only makes sense in portlet-based Web applications. The Portlet specification defines the concept of a global session, which is shared by all of the different portlets that make up a portlet Web application. The bean defined in the global session scope is limited to the lifecycle scope of the globally portlet session. If you use the global session scope in the Web to identify the bean, the Web is automatically used as the type of sessions.