You can also keep the scope as singleton and inject your params at the
method level. That way makes more sense to me as opposed to
instantiating a new resource class for every request. Either way
works though.
Chris
On Tue, May 4, 2010 at 4:03 AM, Paul Sandoz <Paul.Sandoz_at_sun.com> wrote:
>
> On May 4, 2010, at 12:49 PM, Adam Retter wrote:
>
>> On 4 May 2010 09:33, Paul Sandoz <Paul.Sandoz_at_sun.com> wrote:
>>>
>>> Hi Adam,
>>>
>>> Can you send me the output of the server log on deployment?
>>>
>>> Does UriInfo get injected?
>>
>> Yes it does, its just the global ParthParams that are null.
>>
>>> 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.
>>
>> It was the default scope, I did not realise that I needed to change
>> it. Now that you mention it, of course it makes sense :-) After
>> changing the bean to scope="request" all works as expected.
>>
>> Although I also needed to add this to web.xml as the request scope is
>> outside of Springs Dispatcher servlet -
>>
>> <listener> <!-- needed for Request scoped Spring beans that are
>> outside the spring web context - e.g. Jersey -->
>>
>> <listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>
>> </listener>
>>
>> It would be really good to get those two pieces of information added
>> to Jerseys spring integration documentation, all I could find was this
>> -
>>
>>
>> https://jersey.dev.java.net/nonav/documentation/latest/user-guide.html#d4e1280
>>
>>
>> https://jersey.dev.java.net/nonav/apidocs/1.1.5.1/contribs/jersey-spring/com/sun/jersey/spi/spring/container/servlet/package-summary.html
>>
>
> Yes.
>
>
>>
>>> Ideally Jersey should throw a deployment-based exception when such
>>> injection
>>> cannot be performed. Can you log an issue?
>>
>> Sure, I have added an Enhancement request, as issue 524.
>>
>
> Thanks!
> Paul.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: dev-help_at_jersey.dev.java.net
>
>