This week's book giveaway is in the Design forum.
We're giving away four copies of Building Microservices and have Sam Newman on-line!
See this thread for details.
The moose likes Spring and the fly likes What's the difference between 'Inversion of control' and 'Dependency injection'? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Building Microservices this week in the Design forum!
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "What Watch "What New topic

What's the difference between 'Inversion of control' and 'Dependency injection'?

Rogerio Kioshi
Ranch Hand

Joined: Apr 12, 2005
Posts: 689

Are these two terms synonims? If not, what's the difference between both?

Thank you

SampathKumar chinnadurai
Ranch Hand

Joined: Jul 05, 2006
Posts: 44
Check this linkSpring IOC

Cleared SCJP 6 (87%), SCWCD 5 (94%), SCBCD 5.0(95%), PMP ,preparing SCDJWS ,OCUP
Kevin Cho

Joined: Nov 12, 2008
Posts: 20
Just going w/ what someone said to me.

IoC = You give the control to the container to get instance of objects. So instead of you doing "new", let the container do that for you.
DI = The act of "wiring" properties to an object.

Mark Spritzler

Joined: Feb 05, 2001
Posts: 17271

They are synonymous in my mind. With a little added distinction that Kevin pointed out. So IoC also includes injecting dependencies. But DI is just DI not "new" where IoC includes new and DI.


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
Rajesh Rajamanickam

Joined: Aug 10, 2011
Posts: 2

Inversion of control is a general concept to achieve/implement that we use

Dependency injection in spring.

I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link:
subject: What's the difference between 'Inversion of control' and 'Dependency injection'?
jQuery in Action, 3rd edition