Dependency Injection(DI) is the most important feature of Spring Framework. Dependency Injection is a design pattern that removes the dependency between objects so that the objects are loosely coupled. In Spring there exist two major types of Dependency Injection. Setter Injection Constructor Injection … [Read more...]
Spring Dependency Injection – Constructor Injection
Through my earlier posts we have learnt about Spring Setter Injection and all its types, in setter injection we will be having the POJO's for all the property which is present in the class, whereas in Constructor Injection we will have the parameterized constructors which will be setting values to the properties. We will be using <constructor-arg> tag to achieve it. … [Read more...]
Spring Dependency Injection With Properties Example
We have already seen about how to inject dependency to a List, Set and Map Collection, now we will look on injection to a java util Property. Like Map we have key and values associated to the Property as well. We will be using <props> tag in our configuration file to inject values. … [Read more...]
Spring Dependency Injection With Set Collection Example
Previously we have let about Spring Dependency Injection With List Collection, There will not be much of difference between list and set,except we will be having Set in all the places of list. Lets see how to inject values to the Set Collection. We will be injecting String values to a Set and Objects to another Set using <set> tag in our configuration file. … [Read more...]
Spring Dependency Injection With List Collection Example
In my previous article we have already learnt about the Dependency Injection in Spring and Setter Injection in the form of Primitives and injection in the form of Objects. Spring support injection in the form of the collection as well, it supports the below collections. … [Read more...]
Dependency Injection In Spring
Dependency Injection(DI) or Inversion of Control(IoC) is the prominent feature of Spring Framework. Dependency Injection is a design pattern which removes the dependency between objects so that our code becomes loosely coupled. In Spring there exist two major types of Dependency Injection. Setter Injection Constructor Injection … [Read more...]
Spring Dependency Injection – Setter Injection
Dependency Injection is the most important concept of the Spring. It is also called as Inversion of Control (IoC). Dependency Injection makes our code Loosely Coupled, Spring’s IOC container is light-weight and it manages the dependency between objects using configurations. It connects the related objects together, instantiates and supplies them based on configuration. Spring … [Read more...]