Results 1 to 1 of 1
-
What are dependency injection and its advantages
The concept of dependency injection is that it provides a way for objects to define their dependencies (with the other objects they work with) only through constructor arguments, arguments to a factory method, or properties which are set on the object instance when it is being constructed or returned from a factory method. So container actually injects those dependencies when it creates the bean.
Hence code gets much cleaner when the DI principle is applied, and a higher degree of decoupling is much easier when beans do not look up their dependencies.
There are two types of Dependency Injection:
1. Setter Injection
2. Constructor Injection
Similar Threads
-
How to decide whether to use Setter injection or constructor injection in your code
By Java Tip in forum Java TipReplies: 0Last Post: 03-29-2008, 01:38 PM -
How to use Setter Injection and Constructor Injection
By Java Tip in forum Java TipReplies: 0Last Post: 03-29-2008, 01:38 PM -
How to decide whether to use Setter injection or constructor injection in your code
By JavaBean in forum Java TipReplies: 0Last Post: 09-26-2007, 09:29 PM -
How to use Setter injection and constructor injection
By JavaBean in forum Java TipReplies: 0Last Post: 09-26-2007, 09:28 PM -
What are dependency injection and its advantages
By JavaBean in forum Java TipReplies: 0Last Post: 09-26-2007, 09:27 PM
Bookmarks