What is an Ioc pattern?
There are assemblies in .net for establishing this task,
Whats the special in Java /j2ee technologies about IOC

Answers were Sorted based on User's Feedback



What is an Ioc pattern? There are assemblies in .net for establishing this task, Whats the special..

Answer / imtiyaz

Yes i totally agree with the answer of janani,
Now lets dip to one more level

IoC pattern can be implemented in three ways: setter based,
constructor based, and interface based

Setter-Based IoC
This type of IoC uses a setter method to inject the
referenced object into a referring object. This is the most
common type of IoC, and both Spring and PicoContainer
implement it. Setter-based IoC is good for objects that
take optional parameters and objects that need to change
their properties many times during their lifecycles. Its
main disadvantage is that you need to expose all the
properties of an object to the outside world when using a
setter method. This breaks one of the key OO principles:
data encapsulation and information hiding.

Constructor-Based IoC
This type of IoC uses a constructor to set the reference of
the object. Its main advantage is that only the creator
knows about the referenced object. Once the object is
created, the client code that uses the object is unaware of
the referenced object. This approach may not work in all
types of applications, however. For example, if you use an
external API that needs a default constructor, then you
need to go with a setter-based IoC. A constructor-based IoC
is the main type of implementation in Spring.

Interface-Based IoC
In this type of IoC, objects implement a specific interface
from the IoC framework, which the IoC framework will use to
properly inject the objects. One of the main advantages of
this type is that it doesn't need an external configuration
file to configure the object references. Since you need to
use the IoC framework's marker interface, the IoC framework
knows how to glue the objects together. It is similar to
using EJB. Any EJB container knows how to instantiate your
objects and hook them with itself. The main disadvantage of
this approach is that the marker interface ties your
application to a specific IoC framework. Apache Avalon is
based on this approach but this project has been closed.

Is This Answer Correct ?    5 Yes 0 No

What is an Ioc pattern? There are assemblies in .net for establishing this task, Whats the special..

Answer / janani

Inversion of control or dependency injection, its used to
resolve component dependencies by injecting an instantiated
component to satisfy dependency as opposed to explicitly
requesting a component.There is a saying about this the
servicing component says" don't call us we will call you".
Hence this is called inversion of control. This approach
tightly couples the component with the client code.
The inversion control containers generally control the
creation of objects and resolve dependencies between the
object it manages, example spring framework, hivemind etc.
They support eager instantiation and lazy loading.
Im not familiar with .net, so Please anyone answer the
second question

Is This Answer Correct ?    3 Yes 2 No

Post New Answer

More Java J2EE AllOther Interview Questions

can u draw class/object diagram for ATM

0 Answers   HCL, Zycus Infotech,


What is the use of the list interface in the java collection? : java collections

0 Answers  


What is Generic in java? Where can we write Generic ( class or method or objects or etc...)? with simple example? Thanks, Bose. Infosys 2 In which way does a Primitive data type is passed ? Sun- Microsystems 4 what is the use of declaring constructor as private? Sai- Softech 5 what is difference between global methods and local methods? 1 What is meant by class loader and how many types are there? Apple 1 what is meaning of JIT? 4 What is an abstract class? Wipro 5 what is filters and its use? Virtusa 2 why is multiple inheritance not allowed in java? Elementus-Technologies 7 Differences between jdk 1.4 and 1.5 Wipro 4 is JVM platform dependent or independent..? IBM 6 what is main purpose of abstract class? 5 what is difference between colection and collections? Tech-Mahindra 11 What error occurs if a try-catch-finally statement sequence does not have a catch clause? 2 Explain the difference between scrollbar and scrollpane? 1 Explain the differences between public, private, protected and static? 4 Explain the difference between getAppletInfo and getParameterInfo? 1 Is Cegonsoft Pvt.Ltd. a good Institute? 4 Why only one Class is public in one file? Explain in details. Thanks in Advance. 11 Which method will get invoked first in a stand alone application?

0 Answers  


What is the servletcontext listener and what is JspContext and page context pls tell in simple words.

1 Answers   IBM,


What are the uses of the set interfaces in the java collections? : java collections

0 Answers  






What are the interfaces in java collections? : java collections

0 Answers  


Hi Friends, i have searched in google but not clear. can you give bank example with synchronized keyword

0 Answers   TCS,


VSS Objectives

1 Answers  


What are maps interfaces in the java collections? : java collections

0 Answers  


Which is the better framework for web applications, struts or spring, and why?

1 Answers   IBM, TATA,


What is java collection? : java collections

0 Answers  


How to use ANT?

2 Answers  


Categories