dev@jersey.java.net

Re: [Jersey] Spring 3.0.x support?

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Tue, 04 May 2010 10:33:23 +0200

Hi Adam,

Can you send me the output of the server log on deployment?

Does UriInfo get injected?

What is the scope of CareAgencyResource? have you declared it to be a
spring bean in the XML configuration? By default spring managed beans
are singletons.

If the scope is a singleton then @PathParam annotations will not get
injected. You need to modify the scope to be per request.

Ideally Jersey should throw a deployment-based exception when such
injection cannot be performed. Can you log an issue?

Thanks,
Paul.

On May 3, 2010, at 8:08 PM, Adam Retter wrote:

> 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
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: dev-help_at_jersey.dev.java.net
>