Prepare Interview

Mock Exams

Make Homepage

Bookmark this page

Subscribe Email Address

Question: What is IOC or inversion of control?
Answer: As the name implies Inversion of control means now we have inverted the control of creating the object from our own using new operator to container or framework. Now it's the responsibility of container to create object as required.
We maintain one xml file where we configure our components, services, all the classes and their property. We just need to mention which service is needed by which component and container will create the object for us. This concept is known as dependency injection because all object dependency (resources) is injected into it by framework.
Example:
In this example CreateNewStockAccont class contain getter and setter for newBid and container will instantiate newBid and set the value automatically when it is used. This whole process is also called wiring in Spring and by using annotation it can be done automatically by Spring, refereed as auto-wiring of bean in Spring.
Is it helpful? Yes No

Most helpful rated by users:

©2025 WithoutBook