Wednesday, January 11, 2012

Spring Framework

Why Spring ? 

Spring framework is an open source Java platform that provides comprehensive infrastructure support for developing robust Java applications very easily and very rapidly.

Spring is lightweight when it comes to size and transparency. The basic version of spring framework is around 2MB.

Spring framework targets to make J2EE development easier to use and promote good programming practice by enabling a POJO-based programming model.

Spring enables developers to develop enterprise-class applications using POJOs. The benefit of using only POJOs is that you do not need an EJB container product such as an application server but you have the option of using only a robust servlet container such as Tomcat or some commercial product.


Dependency Injection (DI):

The technology that Spring is most identified with is the Dependency Injection (DI) flavor of Inversion of Control. The Inversion of Control (IoC) is a general concept, and it can be expressed in many different ways and Dependency Injection is merely one concrete example of Inversion of Control.

What is dependency injection exactly? Let's look at these two words separately. Here the dependency part translates into an association between two classes. For example, class A is dependent on class B. Now, let's look at the second part, injection. All this means is that class B will get injected into class A by the IoC.


Dependency injection can happen in the way of passing parameters to the constructor or by post-construction using setter methods. As Dependency Injection is the heart of Spring Framework

Spring is an extremely powerful Inversion of control(IoC) framework to helps decouple your project components’ dependencies.

Refer : http://www.vaannila.com/spring/spring-tutorial/spring-tutorial.html for spring IDE setup, and know about setter injection, constructor injection, MVC framework, Spring Hibernate Integration etc..

Spring Interceptor -
Interceptor means when the operation travels to other end, we intercept before as pre_handle and change the behavior and when the operation is done we do post_handle for the same is called interceptor.

Example : pre_insert, post_insert, pre_save, post_save. When the save method called before we call pre_insert and after save we call post_insert

Reference : http://www.tutorialspoint.com/spring/spring_overview.htm

No comments :

// Below script tag for SyntaxHighLighter