Re: JSR311: _at_Target of FIELD for _at_*Param annotations

From: Stephan Koops <>
Date: Mon, 10 Mar 2008 15:15:43 +0100

Hello Marc,
> The key word is singleton. If a resource class is a singleton then you
> only have one instance. For performance that instance needs to be
> reentrant. If you just inject an int then all threads servicing
> concurrent requests will see the same value. Also injection only
> happens at object creation time so only values from the first request
> are injected. See the problem ?
Yes, I see that, for the case, that the resource classes are singeltons.
But the specification says, that "A new resource class instance is
created for each request to that resource." (section "Resource Classes",
subsection "Lifecycle and Environment"). If a new instance is newly
created for every HTTP request, than it's not a singelton.
Or do I miss something?
> Injecting a thread-local proxy is one way round this, you still only
> have a single instance of the resource class but each service thread
> gets its own values of injectables. The proxy hooks back to the
> request context to extract a current value rather than the value for
> the first request.
best regards