Difference between Spring and Struts framework



Spring is a light weight and open source framework created by Rod Johnson in 2003. Spring is a complete and a modular framework, Spring framework can be used for all layer implementations for a real time application or spring can be used for the development of particular layer of a real time application.

Struts is an open-source web application framework for developing Java EE web applications. It uses and extends the Java Servlet API to encourage developers to adopt a model–view–controller (MVC) architecture. It was originally created by Craig McClanahan and donated to the Apache Foundation in May, 2000.

Listed below is the comparison chart of difference between Spring and Strut Framework

Spring
Struts
Spring is a full-stack application framework that provides an MVC Framework
(Spring MVC) as one of its many modules.
Struts is a web framework which can be used to develop web applications using MVC pattern.

Spring Framework is said to be a non-invasive means it doesn’t force a programmer to extend or implement their class from any predefined class or interface given by Spring API
struts is said to be invasive .In struts we used to extend Action Class.
It forces the programmer that, the programmer class must extend from the base class provided by struts API
Spring implements IOC Design Pattern and addresses AOP Cross cutting concerns.
Struts implement MVC Design Patten
Spring is light weight framework
Struts is heavy weight framework
Spring is loosely coupled
Struts is tightly coupled
Spring is a Layered Architecture
Struts is a not a Layered Architecture
Spring provides easy integration with technologies like JDBC, Hibernate
We have to hard code to use technologies
like hibernate, jdbc, etc.
Spring framework not only allows JSPs but also
other views such as Velocity, Freemaker etc.
Struts allows only JSP as a view component.

Spring MVC provides more handler mappings.
Struts doesn’t have specific handler mappings but uses Action Mappings.
It also provides more model transfer.
It has fewer model transfer.
Spring offers complete Decoupling between layers in MVC.

Struts offers limited Decoupling between layers in MVC.

Spring offers IOC (inversion of control) and AOP (Aspect Oriented Programming).
Struts uses IOC internally but doesn’t provide to the programmer / developer.
Spring clear module division between Model, View and Controller.
Struts mixes Controller and Model.
Spring MVC just provides tags for basic HTML form tags
Struts 2 provides many out-of-box JSF-styled complex and composite tags
Such as: Ajax DOJO tags
Spring has spring webFlow for the same purpose, which is part of spring Framework.
Struts will be Generally used as a Front End Frame work.
Advantages of spring Framework:-
- Transaction management
- support for Messaging
- support and Integration with Other Frame works.
(Eg: Hibernate, Struts, Tapestry.. etc)
Advantages of Struts Framework:-
-Excellent support for Tag Library, which has wide industry acceptance.
-Easy to integrate with other client side technologies.


1 comment :