users@jersey.java.net

Problems with jersey-test-framework and Guice

From: bea <beaotx_at_gmail.com>
Date: Tue, 25 Aug 2009 13:37:34 +0200

Hi everyone,
I've been trying to use a IoC container with jersey-test-framework in order
to access a PersistenceManager / Factory within my tests. I've found that,
in order to use Google Guice, I need to create the web container and add to
it a filter, used for the IoC container bootstrapping. I've been stuck with
the problem for a couple of days, using Grizzly as the lightweight
container, but found that the test framework may be missing something
necessary to bootstrap Guice.

I've spotted a couple of changes that may help:

Adding the possibility to the GrizzlyWebContainer class of the
test-framework (com.sun.jersey.test.framework.impl.container.grizzly.web) to
add a filter (so we could add the GuiceFilter to the filter chain).

Adding to the ApplicationDescriptor utility class a list of filters to be
added.

Do you think that this may help or is there any other kind of IoC support
that I've missed?

Thanks