Dependency Injection
Factory Method
Spring framework provides facility to inject bean using factory method. To do so, we can use two attributes of bean element. factory-method: represents the factory…
Autowiring
Autowiring feature of spring framework enables you to inject the object dependency implicitly. It internally uses setter or constructor injection. Autowiring can’t be used to…
Setter Injection with Map 2
In this example, we are using map as the answer that have Answer and User. Here, we are using key and value pair both as…
Setter Injection with Map
In this example, we are using map as the answer for a question that have answer as the key and username as the value. Here,…
Setter Injection with Collection 2
If we have dependent object in the collection, we can inject these information by using the ref element inside the list, set or map. Here,…
Setter Injection with Collection
We can inject collection values by setter method in spring framework. There can be used three elements inside the property element. It can be: list…
Setter Injection Dependent Object
Like Constructor Injection, we can inject the dependency of another bean using setters. In such case, we use property element. Here, our scenario is Employee…
Setter Injection
We can inject the dependency by setter method also. The <property> subelement of <bean> is used for setter injection. Here we are going to inject…
CI Inheriting Bean
By using the parent attribute of bean, we can specify the inheritance relation between the beans. In such case, parent bean values will be inherited…