On Fri, 27 Jul 2007 13:13:15 +0200, Oleg Mikheev <[EMAIL PROTECTED]> wrote:

Łukasz Łapiński wrote:
I would really love to use IoC in my struts project. Has anyone any experiences with integration Struts and Guice.

I'm using Guice, but I'm not defining any modules
(what do you need them for?)
I just added 3 libs (guice-1.0.jar, guice-servlet-1.0.jar,
guice-struts2-plugin-1.0.1.jar) to WEB-INF/lib,
and put this line to struts.xml:
<constant name="struts.objectFactory" value="guice" />

That's all I had to do to be able to use @Inject in actions.

Oleg

Hi Oleg,

thx for the answer. How do you inject into your web applications JNDI resources, such as data sources if you dont use any modules ?
I think this is where one could use

// Bind to DataSource from JNDI.
bind(DataSource.class)
  .toProvider(fromJndi(DataSource.class, "..."));

which comes from Guice user guide.



--
Best wishes,
Łukasz Łapiński

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to