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.



Discussion

No Comment Found