Professional Documents
Culture Documents
Spring
Spring
BeanFactory :---
1.fundamental or base conatiner provided by spring framework.
2.Provide the basic functionalities to spring framework like creation
,maintenacnce of bean objects as provided in configuration file
3.To represent BeanFactory IOC container Spring framework has provided
BeanFactory(I)
org.springframework.beans.factory.Beanfactory interface
ApplicationContext :---
1.AplicationContext is an extension of BeanFactory Container
2.Provides some advanced features of internationlization ,Event Hnadling,
along with the fundamental functionalities BeanFactory is providing
3.Represented by Interface org.springFramework.context.ApplicationContext
(Interface)
4.ApplicationContext is child interface of BeanFactory
ApplicationContext actions:
-->configuraaion file loading
-->configuration file parsing
-->read data from configuration file
-->Recognize all bean configurations
-->get bean name and location of all the bean classes
-->bean class loading-->create bean object -->bean initialization-->storing bean
objects in form of key-->value pairs( id name of property tag (Key)-->Class
Objects(Value)))
Beans Scope : --
In J2SEE we can define the scopes using access modifiers like
private,public,protected ,default
similarly in Spring we can define bean scopes :--
1.Singleton Scope (default )
2.prototype
3.request scope
4.session scope
5.globalSession scope
6.application scope
7.webSocket scope
#To define the Spring configuration file without XML file by using Annotations
Class c= Class.forName("com.core.MyBean");
#2.Bean Instantiation
c.newInstance();
#3.Bean Initialization
#4.Bean DeInstantiation
NOTE: ----
In general We can do Bean initializazation and destruction using all or one of
the above approaches ,But if we use all above three approaches in a single bean at
same time then the Order of Bean initialization wil be following
###Destruction Order
##For calling the init and destroy methods(with same name) for all the Beans we
can mention default-init-method="initMethodNameInAllBeans" deault-destroy-
method="destroyMethodNameInAllBeans" .So while loading the IOC it will call init
destroy methods of all Beans where method is defined after setting all
properties of corresponding bean
--------------------------------------
Bean Inheritance
<beans>
<bean id="" class="parentClass">
<property name="innerbean">
<bean id="innerbean" class="Class">
</bean>
</property>
</bean>>
</beans>