File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Spring and the fly likes Spring IOC Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "Spring IOC" Watch "Spring IOC" New topic

Spring IOC

Kunal Lakhani
Ranch Hand

Joined: Jun 05, 2010
Posts: 622
Spring IOC helps in decoupling dependencies between components.

What does it mean?

Does it refers to enabling loose coupling?

Shashank Ag
Ranch Hand

Joined: Dec 22, 2009
Posts: 88

Yes it enables loose coupling, as injections are configured in a seperate xml files.

SCJP 91%, SCWCD 97%
Sidharth Pallai
Ranch Hand

Joined: Apr 21, 2008
Posts: 134

Spring do provide IOC through Dependency Injection either with Setter Injection or Constructor Injection, with a aim to avoid TightCoupling and enforce LooseCoupling. In tight coupling, one object is heavily dependent on other object like as below.

Lets try attempt to reduce the impact of tight coupled Travel & Car object

Now Spring did it through XML bean configurations .... as below

spring.xml Configuration :

I can define any vehcile in the xml , ie a Train/Aeroplane/Cruise/Horse/Camel............

Thanks & Regards
Sidharth Pallai
naveen gupta
Ranch Hand

Joined: Apr 12, 2006
Posts: 129
@Sidharth Pallai..................Good explanation for a beginner

A lot of these new frameworks came into existence because of design flaws in previous frameworks or whatever..............

So when we try to read or learn these new technologies, most of us don't understand the concepts............the constant question that arises for every concept is why we have to do this way.

For every new concept in these frameworks to understand, i think we should know the flaw in the old system/design/framework

Then we can easily or quickly grasp the new concepts/technologies..........

So the best way to learn any new technology is to first understand the fault in the old frameworks/designs
I agree. Here's the link:
subject: Spring IOC
It's not a secret anymore!