We had the same problem, wanted to use guice to inject the filters, the solution that was arrived modify the GuiceBudle to accpet filters injection, in our case were still wearing the @WebFilter to do this, otherwise you will have to use the Environment.
In AutoConfig class you can create a addFilters method, which will use the library to look for reflections of all classes annotated with @WebFilter, would be something like this:
public void addFilters(Environment env, Injector injector) {
Set<Class<?>> annotatedClasses = reflections.getTypesAnnotatedWith(WebFilter.class);
for (Class<?> annotated : annotatedClasses) {
env.addFilter(injector.getInstance(annotated), annotated.getAnnotation(WebFilter.class).urlPatterns()[0];
}
}
or you can later add the filter in the run method:
@Override
public void run( TListServiceConfiguration config, Environment env ) throws Exception {
env.addFilter(Filter.class, "urlPatterns");
}