Spring Introduction

May 13, 2009 by kssraju

Spring FrameWork:

It is a lightweight multi-tier application Framework. It addresses the most of the infrastructural concerns that are required in implementing the enterprise applications

We can develop enterprise applications , no need of using EJBs

High level abstraction on top of J2EE

Replacement for EJB to implement distributed components in Java

J2EE is a integrated set of individual APIs fordeveloping enterprise applications

figure

Benefits of Spring Framework

Spring is Complete and Modular

Spring is open Source

Spring implemments teh design patterens that are accepted by many projects for solving various problems

Spring provides a better environment for Testing

As Spring is modular it supports incremental adoption

Spring provides Unified Configuration format to configure services from end to end of enterprise application.Avoids to create configurations/fromats of different formats

Spring eliminate the need of implementing the Singleton and Fact9ory patterns which are the most common patterns required to be implemented

Spring framework is divided into  following  modules (as per Spring 2.x)

1. Core Container(IoC Container)

2.AOP Module

3. DAO and JDBC Module

4.ORM Module

5.JEE Module

6.Web MVC Module

figure

Spring Core Container

May 13, 2009 by kssraju

Spring Core Container

  Is An IoC implementation which elminates the need for writing factory classes and methods in most of the cases

IoC is an archetecutral pattern which describes to have an external entity to  perform Dependancy Injection(DI)

Dependancy Injection:

 It is the process of pushing or injecting the dependancies into an Object

Understanding IoC : In OOP we find to divide system requirements into small units , implement them as Objects .Moreover we need to connect these Objects to complete the system. To do this we make an object depend on one or more objects.The objects on which this object depends are referred as dependancies for the object

How an object get its dependancies?

for this we generally use following 2 techniques

  1. create the dependancies: In this case we want to implement our object intelligent to create and prepare the dependancy(In simple we need to implement an object intelligent to instantiate and initialize its dependancies )

             This spproach casues the following problems

              code duplication

             difficult to manage the system

               

  1. pull the depandencies