| Apache Struts 2 Plugin Registry > Home > Guice Plugin |
| Name | Guice Plugin |
|---|---|
| Publisher | Apache Software Foundation |
| License | Open Source (ASL2) |
| Version | 1.0.1 |
| Homepage | http://code.google.com/p/google-guice/ |
| Download | http://code.google.com/p/google-guice/downloads/list |
| Source Code | http://code.google.com/p/google-guice/source |
| Guice User Guide | http://google-guice.googlecode.com/files/Guice%201.0%20User's%20Guide.pdf |
The Guice plugin allows Actions, Interceptors, and Results to be injected by Guice.
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:
<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:
<constant name="guice.module" value="mypackage.MyModule"/>
If all of your bindings are implicit, you can get away without defining a module at all.