aspose file tools*
The moose likes OO, Patterns, UML and Refactoring and the fly likes What is the benefit of using Interface Injection? 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 » Engineering » OO, Patterns, UML and Refactoring
Bookmark "What is the benefit of using Interface Injection?" Watch "What is the benefit of using Interface Injection?" New topic
Author

What is the benefit of using Interface Injection?

Hong Anderson
Ranch Hand

Joined: Jul 05, 2005
Posts: 1936
I don't quite understand what is the benefit of using Interface Injection. It looks similar to Setter Injection but requires implementing an interface.
In which circumstance that we should use Interface Injection rather than Setter Injection?


SCJA 1.0, SCJP 1.4, SCWCD 1.4, SCBCD 1.3, SCJP 5.0, SCEA 5, SCBCD 5; OCUP - Fundamental, Intermediate and Advanced; IBM Certified Solution Designer - OOAD, vUML 2; SpringSource Certified Spring Professional
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 29230
    
135

It's helpful when you want to inject mock objects for testing.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: What is the benefit of using Interface Injection?
 
Similar Threads
setter-based injection in Spring Framework
Dependency Injection: Field injection and Setter Injection.
how can i Pass an object from an Action to jsp page in struts?
Injection at Class Level
DI - Constructor injection / Setter Injection ?