Skip to content

Dependency Injection

Vishnu Garg edited this page Aug 4, 2018 · 3 revisions

Dependency Injection

Two type of dependency injections are there. Constructor-based dependency injection 👍 Constructor-based DI is accomplished when the container invokes a class constructor with a number of arguments, each representing a dependency on the other class. Reference

Setter-based dependency injection Setter-based DI is accomplished by the container calling setter methods on your beans after invoking a no-argument constructor or no-argument static factory method to instantiate your bean.

As you know Java inner classes are defined within the scope of other classes, similarly, inner beans are beans that are defined within the scope of another bean. Thus, a element inside the or elements is called inner bean and it is shown below.

Clone this wiki locally