Spring Containers

Leave a Comment

Wednesday, March 27, 2013

In a spring application all objects (beans defined by spring) are managed by spring container or our application objects lives within the Spring container. Spring Container performs the all the major roles of managing the java objects like:-
  • Spring container creates the objects(beans defined by spring).
  • Wire theirs dependencies like if an object A has a member of Object B type then spring wire the Object B dependencies to Object A.
  • Manage their complete lifecycle from cradle to grave (or new to finalize() as the case may be).
  • The container is at the core of the Spring Framework.
  • Spring’s container uses dependency injection (DI) to manage the components(beans)

Spring comes with several container implementations that can be categorized into two distinct types.

  1. org.springframework.beans.factory.BeanFactory
    Bean factories defined by the org.springframework.beans.factory.BeanFactory interface are the simplest of containers, providing basic support for DI.
  2. org.springframework.context.ApplicationContext
    org.springframework.context.ApplicationContext is a sub interface of org.springframework.beans.factory.BeanFactory
    org.springframework.context.ApplicationContext interface provides application framework services like:-
    • Application contexts provides functionality for resolving text messages, including support for internationalization (I18N).
    • Application contexts provide a generic way to load file resources.
    • Application contexts can publish events to beans that are registered as listeners.

No comments :

Post a Comment