On Fri, Jan 23, 2009 at 11:22 AM, Brian Yarger <[email protected]> wrote:

>
> I'm working on a little experiment trying to ditch spring in a struts2
> project.  We are using spring primarily for 3 things; DI, annotations
> based Transaction support with hibernate/JPA, and authentication/
> authorization.
>
> I've identified guice, warp-persist, and jsecurity to replace our
> usage of spring.  Now, comes the hard part.  Each of these frameworks
> seems to want to be the creator of the guice injector.


warp-persist does not create any injector. The problem as you point out, is
really in the struts2 plugin. You should be able to use Guice Servlet 2.0
(currently trunk) to achieve what you want.

- Put warp-persist's PersistenceFilter in your ServletModule, rather than
web.xml.

- Then install it in your struts module (you will have to put struts filter
in web.xml *below* GuiceFilter).

- The first request, GuiceFilter will not be configured, so it passes
through to struts, which creates the injector and runs. On subsequent
requests, GuiceFilter will intercede with warp-persist, security, etc.

This is a bit hacky, but it gets you there if you don't want to write your
own trivial ObjectFactory to look up the injector from your
ServletContextListener.

Dhanji.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"google-guice" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/google-guice?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to