Home  >  Forum  >  Spring
Post New Query

How spring loads Class and creates object



Asked on March 23, 2014
Suppose we have a bean declaration in Spring as below.

<bean id="ob" class="com.test.MyClass"/> 

Can anyone explain, how spring loads MyClass and creates object?



Replied on April 03, 2014
Spring loads class using custom class loader.

Spring reads the xml and get the fully qualified class name. 
It creates the Object instance as given in example. But to  get instance of the our class,
that class must have an interface and then typecast Object instance by our Interface and you will get the instance of object as discussed in the below link






Write Answer








©2019 concretepage.com | Privacy Policy | Contact Us