Saturday, October 29, 2011

Spring Framework



Spring is an open source framework created to address the complexity of enterprise application development.


*Lightweight container
*No App Server Dependent ? like EJB JNDI Calls
*Objects are created Lazily , Singleton - configuration
*Components can added Declaratively
Initialization of properties is easy ? no need to read from properties file
*Declarative transaction, security and logging service - AOP
application code is much easier to unit test
*With a Dependency Injection approach, dependencies are explicit, and evident in constructor or JavaBean properties
*Spring's configuration management services can be used in any architectural layer, in whatever runtime environment.
*Spring can effectively organize your middle tier objects
*Doesn't require special deployment steps



Inversion Of control :

Inversion of control is based on the phenomenon that says, when ever dependency betwen two classes (say class A and class B) now if A needs to access the methods of B, then following our traditional approach we go ahead and create and object of B in A, but as the fact of matter, B is there to serve A not A serving B creating objects for B , So in IOC the the the class B will try to inject its object into A rather than A creating object of B. so the control is reversed , during the run time now spring container takes care which class object to inject into other class.

Inversion of control or IOC is just a term.  This term is used  in spring framework for its dependency injection. Its all about this much , While your applications starts  it will create the Objects of the Classes listed in application-servlet.xml file and serve that Objects to the  classes which calling it through setter method, contructor,normal method. So that you don't need to create an Object of a class by yourself in that class.

Holywood principle "Don't call me , i will call you"


MartinFowler article on IOC

IOC Container in detail

No comments:

Post a Comment