InterviewSolution
| 1. |
What Bean Scopes Does Spring Support? Explain Them.? |
|
Answer» The Spring Framework supports following five scopes, three of which are available only if you use a web-aware APPLICATIONCONTEXT. singleton: This scopes the BEAN definition to a single instance per Spring IoC container. PROTOTYPE: This scopes a single bean definition to have any NUMBER of object instances. request: This scopes a bean definition to an HTTP request. Only valid in the context of a web-aware Spring ApplicationContext. session: This scopes a bean definition to an HTTP session. Only valid in the context of a web-aware Spring ApplicationContext. global-session: This scopes a bean definition to a global HTTP session. Only valid in the context of a web-aware Spring ApplicationContext. The Spring Framework supports following five scopes, three of which are available only if you use a web-aware ApplicationContext. singleton: This scopes the bean definition to a single instance per Spring IoC container. prototype: This scopes a single bean definition to have any number of object instances. request: This scopes a bean definition to an HTTP request. Only valid in the context of a web-aware Spring ApplicationContext. session: This scopes a bean definition to an HTTP session. Only valid in the context of a web-aware Spring ApplicationContext. global-session: This scopes a bean definition to a global HTTP session. Only valid in the context of a web-aware Spring ApplicationContext. |
|