What is IOC in spring?
Answers were Sorted based on User's Feedback
Answer / sujeev
IOC(Inversion of control)is a technique that allows object
configuration to be moved out of code and into a
configuration file. With Spring IOC, this is typically done
with an XML file.
The steps to use Spring IOC are:
1. Write Java Bean classes, with getter and setter methods
for each property to be configured by Spring.
2. Create an XML file that describes the Java Beans to be
configured.
3. Use an XMLBeanFactory to create configured beans. There
are other ways to read bean descriptions, but using an
XmlBeanFactory is more common.
Is This Answer Correct ? | 80 Yes | 17 No |
Answer / shoban
Ioc is the core container for complete spring framework.
Ioc is designed to just perform "dependency injection".
Spring core module comes with basic spring container whose
name will be "BeanFactory"
Ioc can be designed based on Servicelocator designpattern.
Spring basically supports 2 kinds of injection
1.setter injection
2.constructor injection.
Based on the injection you choose and write proper java code
in bean class.
Dependency injection uses the hollywood principal "Don't
call me i will call u".
The steps to use Spring IOC are:
1. Write Java Bean classes, with getter and setter methods
for each property to be configured by Spring.
2. Create an XML file that describes the Java Beans to be
configured.
3. Use an XMLBeanFactory to create configured beans. There
are other ways to read bean descriptions, but using an
XmlBeanFactory is more common.
Is This Answer Correct ? | 17 Yes | 4 No |
Answer / vinay
IOC is an architectural pattern describes to have an external entity to wire the objects at each creation time
Is This Answer Correct ? | 15 Yes | 3 No |
Answer / krishna chandra mohan a
IoC or Inversion of Control is a design pattern that
provided instances of a bean or class to another when they
needed. That means, we do not have to use new keyword to
create instance of dependent class. We will just create a
reference of dependent class and IoC pattern will set the
instance to the reference when needed.
Is This Answer Correct ? | 9 Yes | 0 No |
Answer / madhusudhakar
when we develop a project we will be providing code to take
care of creating the objects and setting dependencies of the
objects(this is normal course).
if we use spring container we need not creating the code for
creating the objects and setting up the dependencies. the
spring container takes care of this task . the task that is
normally carried out by our code is getting carried out by
the spring container this is called as IOC
Is This Answer Correct ? | 4 Yes | 0 No |
Answer / sagar date
The org.springframework.beans.factory.BeanFactory is the
actual representation of the Spring IoC
container that is responsible for containing and otherwise
managing the aforementioned beans.
The BeanFactory interface is the central IoC
container interface in Spring. Its responsibilities include
instantiating or sourcing application objects, configuring
such objects, and assembling the dependencies
between these objects.
Is This Answer Correct ? | 4 Yes | 2 No |
Answer / somnath mane
The basic concept of Inversion of control pattern is
that you do not create objects but describe how they should
be created.
Is This Answer Correct ? | 6 Yes | 4 No |
Answer / surendra
inversion of control is an architectural pattern describing an external entity(container)used to wire objets at creation time by injecting there dependencies
Is This Answer Correct ? | 4 Yes | 2 No |
Answer / saroj kumar das
IOC is an principle where an external agency is providing
the collaborators to the applicationcontext instead of
component is looking for them.
Is This Answer Correct ? | 3 Yes | 1 No |
Answer / alok kumar ranjan
IoC or Inversion of Control is one of the core features of
Spring. It helps in simplifying the implementation of
business logic. To use the Spring Framework to its full
potential, understanding the IoC container of the framework
is essential.
Is This Answer Correct ? | 19 Yes | 21 No |
Which sorting algorithm is used by collections.sort() in java ?
Should we create system software ( e.g operating system ) in java ?
what are advantages of HQL? what are advantages of Native SQL? what are advantages of Criteria API?
How to call the m1() method of Base class in below snippet ? class Base { public void m1() { System.out.println("Base m1 "); } public void m2() { System.out.println("Base m1 "); } } ====================== class Derived extends Base { public void m1() { System.out.println("Derived m1"); } public void m3() { System.out.println("Derived m3"); } public static void main(String[] args) { Base ob=new Derived(); ob.m1(); //System.out.println("Hello World!"+ob.m1()); } }
wnet use DAO design in u r project?
What are the types of java collections? : java collections
Which java collection class can be used to maintain the entries in the order in which they were last accessed?
When to use the Collection Classes(HashSet, LinkedHashSet, TreeSet....etc) in real time scenario ?
What are the different types of ways where you can iterate over a list? : java collections
How to implement or use the singleton class in java?
2. Write a interface "Car" with the following methods void setName(String) String getName() void setColor(String) String getColor() void setModel(long) long getModel()
What is the difference between Eclipse and MyEclipse?