dependency injection

Home/Tag: dependency injection

Dependency Injection: @Autowired, @Resource and @Inject

In Spring Framework, you can basically use any of the three annotations for Dependency Injection, namely @Autowired, @Resource and @Inject. The @Autowired annotation belongs to the core-spring, however, the other two belongs to the Java extension package @javax.annotation.Resource and @javax.inject.Inject. We will look into the use of each of these annotations with a practical use case, to help you choose [...]

By |2020-04-24T18:26:36+00:00February 23rd, 2020|Categories: Spring Framework|Tags: |

Mapping and Injecting Collections in Spring

Spring Framework supports the injection of the Java Collection types List, Set, Map and Properties. You can use XML as well as annotations based configurations. We will learn Constructor, Setter, and Field injections for the collections using annotations based configurations in this article. The complete code example is available in the GitHub code repository. I recommend understanding the basics of [...]

By |2020-04-24T18:25:57+00:00January 22nd, 2020|Categories: Spring Framework|Tags: , |

Inversion of Control and Dependency Injection in Spring

Inversion of Control (IoC) and Dependency Injection (DI) are programming patterns for decoupling the Class dependencies. In this article, we will talk about IoC and DI with respect to Spring Framework. Read High Level introduction of Spring Framework if you are new to Spring. 1. What is Inversion of Control (IoC)? For simplicity, let's say class Vehicle is dependent on [...]

By |2020-04-24T18:25:29+00:00January 16th, 2020|Categories: Spring Framework|Tags: , , , |