wood burning stoves 2.0
The moose likes Spring and the fly likes Spring Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "Spring" Watch "Spring" New topic


Ken Cole

Joined: Jan 05, 2010
Posts: 1
Hi Ahmad,

I apologize if this question has already been asked, but what are the advantages to using Spring over Struts?

The majority of my development projects have used Struts with the exception of one project which used Spring, Hibernate, Ajax and JSF.

Also, do you see them as competing technologies where one will eventually fall by the wayside and can you give an example of when you would want to integrate Struts with Spring and use both technologies? (I can't think of any reason why you would want to use both in the same project).


Ken Cole

Vyas Sanzgiri
Ranch Hand

Joined: Jun 16, 2007
Posts: 686

There are many advantages of Spring -

Dependency injection
Transaction management are few

if you care for spring web services - I like the contract first interface

We had to integrate Struts with Spring on many projects primarily because of time! - The entire project was in Struts but the new reusable libraries and transactions were developed in Spring for a different project. Rather than write the code again in Struts we decided to interface them. It is easy to start the Spring container and reap benefits of transaction management.

===Vyas Sanzgiri===
My Blog
David Newton

Joined: Sep 29, 2008
Posts: 12617

The book is about Spring, persistence, and Hibernate--not about Spring MVC, which is the part of Spring comparable to Struts.

I have used Struts, both Struts 1 and Struts 2, with Spring for almost every project I've ever done. Some were originally Struts projects that I integrated Spring into for the DI and persistence/tx mgmt. I prefer Struts 2 over Spring MVC (although Spring 3 might convince me otherwise), but use Struts 2's Spring integration for action instantiation/DI.

I have used Spring pretty extensively, but my MVC layer is still usually Struts 2.
praneeth ram
Ranch Hand

Joined: Sep 21, 2009
Posts: 60
The main diffarence between spring and struts is

By Using Struts we can develop only webapplications.

but By using Spring we can develop any type of applications.that my be stand alone applications,web,enterprise,distributed..etc.
for this one only spring contains 6modules.like spring core,spring aop,spring j2ee,...etc

but in struts there is no such type of moduls.
David Newton

Joined: Sep 29, 2008
Posts: 12617

Nor is there supposed to be--as I said, Struts is equivalent to Spring MVC.
Babji Reddy
Ranch Hand

Joined: Jan 24, 2006
Posts: 106
Spring provides an additional layer 'web flow' that gives ability to web applications to have a 'conversational state/scope' in addition to the the standard page,request and session scopes from J2EE.
I agree. Here's the link: http://aspose.com/file-tools
subject: Spring
It's not a secret anymore!