users@jersey.java.net

automatic resource registration and guice

From: Christopher Piggott <cpiggott_at_gmail.com>
Date: Wed, 2 Jun 2010 15:51:06 -0400

I don't want to have to explicitly bind my resource classes to guice.
Reading the very end of this:

https://jersey.dev.java.net/nonav/apidocs/1.2/contribs/jersey-guice/com/sun/jersey/guice/spi/container/servlet/package-summary.html#package_description

it seems that I shouldn't have to, if I do those three things.

1. My resource class has a default constructor that's annotated @Inject
2. My resource class is not explicitly bound
3. My class is registered by me doing this:

        params.put(PackagesResourceConfig.PROPERTY_PACKAGES,
RootResource.class.getPackage().getName());
        serve("/*").with(GuiceContainer.class, params);

(assuming, for now, that all my resources are in the same package as
RootResource.class)



Is there something more I have to do to avoid explicit binding?

--Chris