Configuring Stripes-Guice 1.5.x


Configure your web.xml to use the GuiceContextListener provided in Stripes-Guice.


After the listener is configured add a context-param named Guice.Modules and provide a comma-delimited fully qualified guice module class names.


Finally you need to configure stripes to make use of the GuiceActionResolver, GuiceActionBeanContextFactory, and GuiceRuntimeConfiguration. This will provide your ActionBeans, ActionBeanContext, and Interceptors with full Guice constructor and member injection support. All you need to do is add the following configurations to Stripes and annotate your classes as you would any other Guice injectable class.

NOTE: If you already have an implementation of these classes you can change the classes your implementation extend to extend the Stripes-Guice implementations. This is not an ideal approach. But, it will maintain the most consistent feature support across Stripes 1.5 and 1.6.

    <display-name>Stripes Filter</display-name>

Implement Custom GuiceInjectorFactory

If you do not want to use the Default means of creating the Guice Injector you can override it by implementing your own GuiceInjectorFactory.
First, write your own implementation of the GuiceInjectorFactory. In the following example the implementation hard codes the Modules instead of using the default mechanism of Guice.Modules context-param. It also passes the created injector into a static context that can be exposed to non-stripes components. This should be an unusual case. But, the need may arise.
public class CustomInjectorFactory implements GuiceInjectorFactory {
    public Injector getInjector(ServletContext servletContext) {
        Injector injector = Guice.createInjector(new MyServiceModule(), new MyWebModule());
        return injector;
Next and finally, specify your custom implementation in a GuiceInjectorFactory.Class context-param.