Monday, April 3, 2017

Explain about spring container in Spring IoC JavahighQ

         Explain about spring container?

     BeanFactory :-

If we have two beanfactory containers it the application, we con set one BeanFactory into another beanfactory to allow the beans in one beanfactory to refer to the beans of other factory in this we can declare one beanFactory as a parent and other as a child. This is similar to concept of base class and derived classes derived class can access the properties of base class but base classes cannot access the properties of derived class.
In order to refer to parent beans we can use tag<ref parent=””/>
Apart from parent attribute it has local which indicates refer to the local first if not found then search in parent factory and perform injection.

        ApplicationContext  Container:-

          It is an enhancement for BeanFactory container . To activate ApplicationContext container  we can create object fro the java class that implements ApplictionContext interface. This is sub interface of Beanfactory(I).

There are three important implementations classes for ApplicationContext(I)
Thery are  :-
          
       a)      FileSystemXmlApplictionContext
       b)     ClassPathXmlApplictionContext
       c)      XmlWebApplictionContext
       d)     AnnotatinConfigApplicationContext

Note :-  

ApplicationContext container is originally of spring context/spring JEE module.
ApplicationContext container can erform every activity of BeanFacotry container but it also gives the following additional features.
         
           1.       Ability to work with multiple spring cfg flies
           2.       Pre-Instantiation of singleton class
           3.       Ability to working property files.
           4.       Support to work with 18n(internationalization).

           5.       Ability to work with event listeners 

        By activating BeanFactory container fo one time we con’t make that container dealing multiple spring configuration files but this activity is possible by using ApplicationContext container. 



No comments:

Post a Comment