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.
Read the link Custom ClassLoader Java Example
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