Este contenido no está disponible en el idioma seleccionado.
Chapter 36. Guice 1.0 Integration
RESTEasy does have some basic integration with Guice 1.0. RESTEasy scans a Guice Module's binding types for
@Path
and @Provider
annotations, and registers these bindings. The guice-hello
project that comes in the RESTEasy examples/
directory gives a nice example of this.
Start by specifying a JAX-RS resource class — in this case, the
HelloResource
. Next, create a Guice Module class that defines your bindings:
Place these classes within your
WAR WEB-INF/classes
or in a JAR
within WEB-INF/lib
. Then, create your web.xml
file. You will need to use the GuiceResteasyBootstrapServletContextListener
like so:
GuiceResteasyBootstrapServletContextListener
is a subclass of ResteasyBootstrap
, so you can use any other RESTEasy configuration option within your web.xml
file. Also note the resteasy.guice.modules
context parameter. This can take a comma delimited list of class names that are Guice Modules.