J2EE Concepts

The category majorly caters to j2ee and related technologies. Developing sample applications.

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

Bootstrap your Spring Application – Bean Collaboration

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". Now we know about the beans and the containers . We defined couple of beans as well. But what is an application good for if the beans do not interact? This post describes how to bootstrap your spring application. Almost all applications will need beans to collaborate with each other and deliver some results. And this is achieved using Dependency Injection. Recalling our discussion from the Inversion of Control post, if a con...
Read More

Spring Application Configuration using Annotations

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 last post we learnt about Spring XML configurations, specially defining beans in XML using all the bean instantiation methods. In this post, let us try to take one more step and learn the Annotations based configurations. I have described annotations in one of the previous post. Spring Application Configuration using Annotations As I mentioned in earlier posts that configurations can be defined in many ways like XML...
Read More

Spring Application Configuration XML based

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". At this point I believe it is appropriate to introduce Spring application configuration. In this post, we will also need the concepts learnt so far. I have made sure that you won't need anything which is not discussed so far. Writing a Spring Application Configuration A set of one or more configuration metadata makes up a Spring configuration. I have described the configuration metadata in this post.  The configuration metada...
Read More