...
The Guice plugin
Excerpt |
---|
allows Actions, Interceptors, and Results to be injected by Guice |
Requirements
- Struts 2.x0.6+
Installation
...
and Usage
To install the Guice Struts 2 plugin with Struts 2.0.6 or later, simply include guice-struts2-plugin-1.0.jar in your web application's classpath and select Guice as your ObjectFactory implementation in your struts.xml file:
Code Block |
---|
<constant name="struts.objectFactory" value="guice" />
|
Guice will inject all of your Struts 2 objects including actions and interceptors.
You can even scope your actions. You can optionally specify a Module for Guice to
install in your struts.xml file:
Code Block |
---|
<constant name="guice.module" value="mypackage.MyModule"/>
|
If all of your bindings are implicit, you can get away without defining a module at allThis plugin can be installed by copying the plugin jar into your application's /WEB-INF/lib
directory.