What do you mean by spring beans?  What does bean scopes spring support? Explain each.

devquora
devquora

Posted On: Feb 22, 2018

 

The objects, which are most important for the user’s application and are managed by the containers of Spring IoC are called beans. A bean is an object that is initialized, put together, and is managed by a Spring IoC container. The beans are created with the help of configuration metadata that are supplied to the container by the users.

The Spring Framework makes use of five scopes. Three of these scopes are valid only if it is in the form of a web-aware Application Context.

  • Singleton: This is the scope that the bean defines to a single instance for each Spring IoC container.
  • Prototype: This is the scopes that a bean defines to have any number of object instances.
  • Request: This is the scopes that a bean defines as per HTTP requests. This is valid in the form of a web-aware Spring Application Context
  • Session: This is the scopes that a bean defines to an HTTP session. This is valid in the form of a web-aware Spring Application Context
  • Global-session: This is the scopes that a bean defines to a global HTTP session. This is valid in the form of a web-aware Spring Application Context.

    Related Questions

    Please Login or Register to leave a response.

    Related Questions

    Spring interview questions

    What are the features/ characteristics of spring?

    The important features of spring are as follows:Lightweight: Considering transparency and size, spring is lightweight..

    Spring interview questions

    How many types of modules are there in spring? Name them.

    There are around twenty modules, which can be categorized into Core Container, Web, Data Access or Integration, Aspect ..

    Spring interview questions

    What do you mean by Spring Java Based Configuration?

    Spring configuration files are XML files. These files contain the information of classes and describe how these classes..