Resources and ResourceLoaders 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“. An enterprise level application is found to deal with a lot of resources, both static and dynamic. For e.g. properties files, images, xmls etc. In this post we will discuss about resources and ResourceLoaders in Spring. Resources and ResourceLoaders in Spring It is important to understand, how Spring treats a Resource and what does it mean when we say Resource in a Spring application. What is a Resource? A resou...
Read More

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

Constructor 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". We now know a lot about Spring beans and in the last post we mentioned about the dependency injection. It precisely means, how to connect two beans when one bean is composed in another bean. So let us start with practical implementation of Constructor Based Dependency Injection in Spring. Constructor Based Dependency Injection Constructor Based Dependency Injection is the one in which the wiring between beans is achieved usin...
Read More