Gregg - I wasn't making a recommendation - just sharing the outcome of
something I did recently. Generally I start my transactions in the
service layer, or in use-case-aligned business controllers that are
below my presentation tier. Stripernate is an example of the
"transaction per request" approach, which is popular too.
My impression is that there are simpler projects out there where (for
example) ActionBeans are talking directly to DAOs. They may find some
utility in declaring transactions at the ActionBean level.
For me, the most useful thing about the SpringObjectFactory is the
ability to use Spring Security annotations on ActionBean classes and
event handlers.
Chris.
On Dec 8, 2008, at 11:16 AM, Gregg Bolinger wrote:
So is handling transactions in a controller a good idea? I've not
investigated the appropriate patterns for this so I'm not arguing
one way or another, yet. ;) Do you have links that say this is a
good/better idea than putting them somewhere else? Say, in the
service/business tier?
Gregg
On Mon, Dec 8, 2008 at 10:03 AM, Chris Herron <[EMAIL PROTECTED]>
wrote:
Hi Gregg:
I was talking about declarative JTA transactions. Spring can act as
a transaction manager (or abstract an underlying one). It works out-
of-container which is nice. You can use annotations to mark methods
as transactional / read-only / requires-new etc. This provides more
granularity than the approach of starting / committing a transaction
via a servlet filter or Stripes interceptor.
I assume that Christians' Interceptor would not be necessary if you
use the SpringObjectFactory. I do assume and hope that the the
@SpringBean annotation will continue to work - because I don't want
to clash with Stripe's own Spring support.
Chris.
On Dec 8, 2008, at 10:46 AM, Gregg Bolinger wrote:
Chris. This looks interesting. I have a couple of questions.
When you say "transactions" what kind of transactions are you
talking about? Also, if a stripes bean is a true spring bean then
won't the @Autowire annotation just work without Christian's
interceptor? At least, I would think so.
Gregg
On Mon, Dec 8, 2008 at 9:28 AM, Chris Herron <[EMAIL PROTECTED]>
wrote:
Hi everybody,
We've seen a few different ways to integrate Stripes with Spring.
There's the built-in @SpringBean annotation, and Christian Nelson
recently shared an Interceptor implementation that allows the use
of the @Autowired annotation in ActionBeans. What both of these
have in common is that the ActionBean becomes a recipient of
injected dependencies, but does not become a Spring Bean itself.
I was interested in being able to use the Spring transaction and
security annotations within my ActionBeans. It turned out that the
only viable way to do this was to make the ActionBeans fully-
fledged Spring beans. So that's what I did.
Some of you probably know that Stripes 1.5.1 (not yet released)
will include an ObjectFactory interface that provides a way for us
to control the instantiation of most of the common Stripes
components. I have added the SpringObjectFactory to the
StripesStuff project. It turns ActionBeans and Interceptors into
actual Spring beans, thus allowing the use of annotations for
transactions and security.
Regarding dependency injection, I assume that this will be
compatible with the Stripes @SpringBean annotation, and it should
also work with @Autowired, but since that was not my goal, I did
not test this. I would really appreciate if those interested would
test the DI and send me feedback.
There are some limitations related to 1) Spring component-scanning
and 2) the need to use CGLib proxies - see the release notes for
details.
Please note that if you want to try this before Stripes 1.5.1 is
released, you will need to check-out and build Stripes from the
source!
Chris.
To download, visit the Stripes Stuff Main Page (http://www.stripes-stuff.org/
), then go to "Download", then "Browse All Packages":
Direct links:
SpringObjectFactory Distribution Zip
Release notes and setup instructions
Source (in subversion)
------------------------------------------------------------------------------
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas,
Nevada.
The future of the web can't happen without you. Join us at MIX09
to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
_______________________________________________
Stripes-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-users
------------------------------------------------------------------------------
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas,
Nevada.
The future of the web can't happen without you. Join us at MIX09
to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/_______________________________________________
Stripes-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-users
------------------------------------------------------------------------------
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas,
Nevada.
The future of the web can't happen without you. Join us at MIX09 to
help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
_______________________________________________
Stripes-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-users
------------------------------------------------------------------------------
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas,
Nevada.
The future of the web can't happen without you. Join us at MIX09 to
help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/_______________________________________________
Stripes-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-users
------------------------------------------------------------------------------
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you. Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
_______________________________________________
Stripes-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-users