springframework

Understanding the ApplicationContext in Spring

Introduction This is a series and it would make a lot of sense if read in a sequence. You can find all the posts under the heading “Spring Beginners to Professionals“. In the previous post we discussed the BeanFactory in detail. Here we will try and put some more effort in understanding the ApplicationContext and its flavors. Understanding the ApplicationContext We have reached far enough and have acquired good knowledge to understand the concept of the Application Context. It is a sub interface of ListableBeanFactory and HierarchicalBeanFactory discussed in the previous post. Why do we ne...
Read More

Understanding the BeanFactory – Spring

Introduction This is a series and it would make a lot of sense if read in a sequence. You can find all the posts under the heading “Spring Beginners to Professionals“. In the previous post we mentioned about the BeanFactory. Here we will try and put some more effort in understanding the BeanFactory. A deeper understanding of the BeanFactory will ease our journey further. Understanding the BeanFactory As our XML configuration metadata is a container of bean elements, so is our BeanFactory a container of BeanDefinitions and in turn beans. We can consider the BeanFactory as a central registry ...
Read More

Tips and Tricks of Dependency Injection in Spring

Introduction This is a series and it would make a lot of sense if read in a sequence. You can find all the posts under the heading "Spring Beginners to Professionals". In this post, we will discuss few more tips and tricks of dependency injection in Spring. There are different types of objects and primitive values which qualify to get injected into a bean. As a developer and architect, it is important for us to understand all these concepts. Here, in this post, we will try to discuss the ones which are frequently used. Injecting Primitives and Strings Beans can have properties which are ...
Read More

Setter Based Dependency Injection in Spring

Introduction This is a series and it would make a lot of sense if read in a sequence. You can find all the posts under the heading "Spring Beginners to Professionals". As promised in the previous post, this post will help us understand the second form of dependency injections. Here I will introduce setter based dependency injection. Setter Based Dependency Injection There is another way of injecting dependencies into beans. After instantiating the bean, the container invokes the setter methods for the given property and sets the required property. Let us inject our DataStore bean into Or...
Read More

Constructor Argument Resolution – Constructor Based DI

Introduction This is a series and it would make a lot of sense if read in a sequence. You can find all the posts under the heading "Spring Beginners to Professionals". As promised in the previous post, this post will help us resolve different ambiguities in constructor argument resolution. We will also talk about various possible ways of resolving constructor arguments. There are different variants of the problem with different types of configurations. For e.g. few problems/ambiguities which exists in XMLs might not be there in Annotation based configuration and so on. Hence, we will discu...
Read More