Yeah the InstanceFactory really isn't that big of a change.  If I get bored 
Sunday evening I might just finish what I started and submit a patch.  However 
I don't like the fact that any person writing code for stripes has to be aware 
of this.  If they aren't, some calls to class.newInstance() or new X() could 
still make it in.

But providing customizable class instantiation pretty much solves all 
integration issues DI frameworks be it spring, guice, ejb or whatever.  The 
existing spring integration could be deprecated, instead of annotating and 
reflecting on fields/methods, just define your beans and set their dependencies 
in the context.xml.  What's not to like about that? =)

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Sam Beran
Sent: Friday, June 06, 2008 11:11 AM
To: stripes-users@lists.sourceforge.net
Subject: Re: [Stripes-users] Ann: Stripes-guicer (new version)



David G Friedman wrote:
>
> You need to have your Interceptor run @Before the
> LifecycleStage.ActionBeanResolution stage.  This is where you do your
> Guice constructor instantiation and save your new bean into the request
> scope (or the session scope if you used the @SessionScope annotation)
> using the proper key (string matching the URL binding/path).  After that
> call the usual proceed() method to continue the lifecycle processing.  The
> regular ActionBeanResolution stage should check if your ActionBean already
> exists in the appropriate scope and use it automatically.
>
Are you suggesting bypassing any custom ActionResolver entirely, and
duplicating ActionResolution logic? I don't think I want to go down that
road. I would rather have a standardized way of instantiating, like John
Newman is suggesting:


John W Newman wrote:
>
> YES this is exactly what I was getting at with my post about configurable
> class instantiation here
> http://www.nabble.com/Idea-regarding-use-of-class.newInstance%28%29-and-spring-integration-to17254970.html#a17256401
>

That would be absolutely awesome for DI frameworks to hook into stripes.
Although I submit calling it InstanceFactory to conform to Stripes'
conventions. It really wouldn't be tough to implement. Class.newInstance()
is called 21 times in Stripes proper 1.5rc1.


Gerald Quintana wrote:
>
> Is it necessary to intercept all stages and do injection at each one?
> @Intercepts({LifecycleStage.ActionBeanResolution,
>     LifecycleStage.HandlerResolution,
>     LifecycleStage.BindingAndValidation,
>     LifecycleStage.CustomValidation,
>     LifecycleStage.EventHandling,
>     LifecycleStage.ResolutionExecution,
>     LifecycleStage.RequestInit,
>     LifecycleStage.RequestComplete})
> public class GuiceInterceptor implements Interceptor {
>
> If the action injected the first time during action instanciation, and
> another time in the interceptor, isn't it a problem?
>

I think you are on to something here GĂ©rald. The reason I am doing this on
all Lifecycle stages is to perform field/member injection on any
interceptors during that stage. However, there is no reason to perform
injection on the ActionBean / ActionBeanContext all these times. I also need
to look at whether I should inject the members of an interceptor for each
lifecycle stage it intercepts. The actual injection is done in
StripesFakeFilterChain, if you're interested in taking a look at that as
well.

Thanks to everyone for your input!

Sam
--
View this message in context: 
http://www.nabble.com/Ann%3A-Stripes-guicer-%28Guice-for-Stripes%29-tp17649051p17694527.html
Sent from the stripes-users mailing list archive at Nabble.com.


-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users

Reply via email to