1600 PMP mock questions 1400 CAPM mock questions 800 SCJP 6 mock questions 600 OCAJP 7 mock questions 590 OCPJP 7 mock questions 556 SCWCD 5 mock questions 500 OCEJWCD 6 mock questions pdfDownload (java,struts, hibernet etc)

Spring interview questions

!!! Spring interview questions !!!

Q;What is IOC - Inversion of Control ?



The basic concept of the Inversion of Control pattern (also known as dependency injection) is that you do not create your objects but describe how they should be created.
For Example :
In the XML file you declare
<bean id="creditRating" class="springexample.creditrating.CreditRating">
</bean>
You don't need to create object for CreditRating.
No nned to do new CreditRating(). Spring container will create the object for you.


You don't directly connect your components and services together in code but describe which services are needed by which components in a configuration file. A container (in the case of the Spring framework, the IOC container) is then responsible for hooking it all up.
In a typical IOC scenario, the container creates all the objects, wires them together by setting the necessary properties, and determines when methods will be invoked.

For Example :
In the XML File
<bean id="createCreditCard" class="springexample.creditcardaccount.CreateCreditCardAccount">
        <property name="daoInterface">
            <ref bean="dao" />
        </property>
                
    </bean>

Then Spring container will create the dependency relation. CreateCreditCardAccount class should have setter and getter for daoInterface.

You don't need to create daoInterface object and set the setter method. Spring container will do for you.

The two major flavors of Dependency Injection are Setter Injection (injection via JavaBean setters); and Constructor Injection (injection via constructor arguments). Spring provides sophisticated support for both, and even allows you to mix the two when configuring the one object

Reviews and Comments


PMP, CAPM, PMI is a registered certification mark of the Project Management Institute, Inc

Copyright © www.techfaq360.com 2016


About US | Contact US | Privacy Policy | Terms and Conditions  | Website disclaimer  | Cancellation and Refund Policy  | Shipping & Delivery Policy