dev@jersey.java.net

Re: [Jersey] Spring 3.0.x support?

From: Adam Retter <adam.retter_at_googlemail.com>
Date: Mon, 3 May 2010 19:08:31 +0100

I have had some success but still some issues -

> <dependency>
>            <groupId>com.sun.jersey.contribs</groupId>
>            <artifactId>jersey-spring</artifactId>
>            <version>1.1.5</version>
>            <exclusions>

I needed to add the additional exclusion -

<exclusion>
 <groupId>org.springframework</groupId>
 <artifactId>spring-web</artifactId>
</exclusion>


But the problem is now, that when I use my Jersey REST Services inside
Spring, any global PathParam(s) are no longer injected, for example
with this style class -

@Path("/careAgency/{careAgencyId}")
public class CareAgencyResource {

    @Context UriInfo uriInfo;
    @PathParam("careAgencyId") private Integer careAgencyId;

    @GET
    @Path("logo")
    @Produces("image/*")
    public Response getLogoResource()
    {
        //code goes here
    }
}

For example with this URL -
http://localhost:8084/AccountableCare/resources/careAgency/1/logo

The variable careAgencyId is always null. :-(
When I was using Jersey outside of Spring, it all worked. However, it
was a complete nightmare trying to access my spring managed beans from
inside my Jersey REST classes.

Any ideas if there is a bug in global PathParam injection when using
Spring with Jersey?


-- 
Adam Retter
skype :adam.retter
http://www.adamretter.org.uk