This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
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


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "Spring IOC" Watch "Spring IOC" New topic
Author

Spring IOC

Kunal Lakhani
Ranch Hand

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

What does it mean?

Does it refers to enabling loose coupling?


kunal
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: http://aspose.com/file-tools
 
subject: Spring IOC
 
Similar Threads
To authors
IOC in Seam
webwork IOC when compared with ither IOC frameworks
What's the difference between 'Inversion of control' and 'Dependency injection'?
struts vs spring framework