users@jersey.java.net

Re: [Jersey] _at_Context annotated field in spring bean with prototype scope.

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Fri, 30 Jan 2009 16:15:05 +0100

On Jan 30, 2009, at 3:34 PM, Erick Dovale wrote:

> Folks,
> I can't get jersey to inject the HttpHeaders instance in a @Provider
> annotated entity provider (MessageBodyWriter) which is a spring
> managed bean with scope prototype.

You cannot use providers in anything other than the singleton scope.

I am surprised Jersey is not throwing an runtime exception in such a
case which states:

   "The scope of the component <c> must be a singleton"

What version of Jersey are you using?

It is possible to share a simple maven project that reproduces your
problem?

Paul.

>
> The bean is defined in a spring context and jersey is successfully
> discovering it, however, jersey fails to inject the HttpHeaders
> instance.
> Has anyone had a similar problem before?
>


> Thanks.
>
> Erick.