Showing posts with label Spring. Show all posts
Showing posts with label Spring. Show all posts

Tuesday, November 15, 2011

Spring MVC web Framework flow

The Spring Workflow

  1. The Client requests for a Resource in the Web Application.
  2. The Spring Front Controller, which is implemented as a Servlet, will intercept the Request and then will try to find out the appropriate Handler Mappings.
  3. The Handle Mappings is used to map a request from the Client to its Controller object by browsing over the various Controllers defined in the Configuration file.
  4. With the help of Handler Adapters, the Dispatcher Servlet will dispatch the Request to the Controller.
  5. The Controller processes the Client Request and returns the Model and the View in the form of ModelAndView object back to the Front Controller.
  6. The Front Controller then tries to resolve the actual View (which may be Jsp, Velocity or Free marker) by consulting the View Resolver object.
  7. Then the selected View is rendered back to the Client.

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