users@jersey.java.net

Jersey, Spring and UT

From: Jean Aurambault <aurambaj_at_yahoo-inc.com>
Date: Thu, 06 Mar 2008 14:48:07 +0100

Hil,

I try to use spring with jersey 0.6 as described in Paul's article. I
would like to make Unit tests following this pattern: http call -->
jersey (use of spring to inject dao) --> dao (use of spring to manage
transaction and entity manager) --> hsqldb
Before using spring I was doing these tests with an in memory HTTP
server, here is an extract of the code:

    String[] packageNames = {...};
  ResourceConfig rc = new PackagesResourceConfig(packageNames);

  HttpHandler handler =
ContainerFactory.createContainer(HttpHandler.class, rc);
  server = HttpServerFactory.create(serverUrl + ":0/", handler);

So it doesn't work anymore with spring. I try to use jetty to run the
whole web application but it seams there is a problem when loading
resources:
com.sun.ws.rest.api.container.ContainerException: The ResourceConfig
instance does not contain any root resource classes.

Any advice on how to implement these tests? Have you some tips about
jetty resource loading (by the way I use maven)?


Regards,

Jean.