struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeromy Evans <>
Subject Re: Struts 2 !!!OK!!! cannot we live without Spring?
Date Sun, 02 Sep 2007 00:42:15 GMT
Hi Hayrol,

I'm currently involved with a a). S2 project that doesn't use any IOC 
framework, b). one that uses S2+Guice, c). another with S2+Spring and 
other d). with S2+EJB3 (all with JPA/Hibernate3)

a) If you don't use an IOC framework you'll find you have to provide 
services to your actions anyway either by injection from your own S2 
interceptor, via the servlet context, a service locator or singletons. 
For a project of any reasonable size it quickly gets out of hand, but 
you can get survive.  You will need to write your own Session-in-view 
interceptor for Hibernate if you need that.

b). Guice integrates easily with S2 and is very elegant and simple to 
use.  You'll be able to inject dependencies into your actions and use 
the basics of AOP.  It's pleasant to use if all you want is @Inject.  
You'll need to write your own session-in-view interceptor for Hibernate 
if you need that.  It doesn't provide anything else, which is nice in 
some regards.  I definitely recommend it over a).

c). Spring integrates easily with S2 and simplifies integration with 
most other things you may need (web services, JMS, mail, AOP etc).  It's 
a massive time-saver, but if you don't really know what you're doing, or 
don't really understand how spring works it's easy to stuff things up or 
simply get confused.  Most of the criticism spring receives is because 
programmers have used and abused it (ie. they end-up coding in XML 
instead of java due to their own/teams poor design and don't understand 
spring errors).  Its inevitable you'll have to learn Spring at some 
point because it's everywhere and not about to go away.  I definitely 
recommend it over a).

d). Although EJB3 is a massive simplification compared to prior 
versions, it's not a productivity-focused framework like b. or c..  It 
doesn't integrate with S2 at all (eg. can't inject into actions without 
providing your own mechanism) and I find it's better to use b. or. c. to 
access EJB3 services.  The benefit of EJB3 is that it forces you to 
focus on aspects of the architecture that are important for large-scale 
projects (such as ensuring services can pooled, distributed, passivated 
and a constant focus on transactions and security), but this is 
irrelevant for most web projects. I wouldn't recommend it unless you had 
a lot of prior experience and a genuine need (eg. consider it if you're 
considering distributed transactions).

Hope that's helpful.  I won't ever get into an argument about the 
benefit of b). vs. c). vs. d). because they're all useful under certain 
circumstances and most Java forums already contain a useless thread on 
the topic.

 Jeromy Evans

Hayrol Reyes Mejía wrote:
> Ok, thanks guys.
> But it's not completely clear for me why to use: Struts2 + Spring2 + Hibernate3 ... if
I can do the same with Struts2 + Hibernate3 avoiding a layer of possible problems. Maybe it's
because I think of a MVC framework that provide me all the necessary to build the View of
the application with JSP the controler with Actions and Mappings and the interface model with
Hibernate without the need to look away for other solutions parts.
> Any way, I'll have to give a look to Spring sections that "rocks" and try it according
to documentations I found.
> Best Regards,
> Hayrol
>> Date: Fri, 31 Aug 2007 22:40:48 -0400> From:> To:>
Subject: Re: Struts 2 !!!OK!!! cannot we live without Spring?> > Plus, if you haven't
used Spring, you should give it a try, it rocks,> except the MVC, IMO (but I'm biased anyway
:) )> > musachy> > > > On 8/31/07, Dave Newton <>
wrote:> > --- Hayrol Reyes Mejía <> wrote:> > > why
I have found several documentation, tutorials,> > > etc, that always include Spring?
... It's supposed> > > that we need to live with Spring for the rest of> >
> the live?> >> > You don't need to use Spring if you don't want to.> >>
> Spring consists of many independent parts; you do not> > need to use all of it
-- the primary use in S2> > applications is primarily dependency injection, which>
> is very simple to set up and maintain.> >> > I suspect many of us also use
it for database access,> > but that's certainly not required (although it's a> >
pretty good idea, in my opinion).> >> > d.> >> >> > --------------------------------------------------------------------->
> To unsubscribe, e-mail:> > For additional commands,
e-mail:> >> >> > > -- > "Hey you! Would
you help me to carry the stone?" Pink Floyd> > --------------------------------------------------------------------->
To unsubscribe, e-mail:> For additional commands, e-mail:> 
> _________________________________________________________________
> Explore the seven wonders of the world
> ------------------------------------------------------------------------
> No virus found in this incoming message.
> Checked by AVG Free Edition. 
> Version: 7.5.484 / Virus Database: 269.13.2/983 - Release Date: 1/09/2007 4:20 PM

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message