Hi Paul,
thanks for the reply!
I filed an issue (#538).
Jörg
On Jun 2, 2010, at 11:39, Paul Sandoz wrote:
> Hi Jörg,
>
> That is a bug. Can you log an issue?
>
> Good to see the new error reporting working (which in a later version of the SNAPSHOT, if available will result in a deployment or runtime error rather than null being injected).
>
> In the interim if you need access to the declared root resource and provider classes you inject:
>
> @Context ResourceConfig rc;
>
> Paul.
>
> On Jun 2, 2010, at 2:55 AM, Jörg Richter wrote:
>
>>
>> Hi,
>>
>> When using the servlet init parameter javax.ws.rs.Application the Application instance is not injected into @Context Application annotated variables.
>>
>> Neither into a class field:
>>
>> public class MyResource {
>> @Context Application app;
>> ...
>> }
>>
>> Nor into a constructor parameter:
>>
>> public MyResource(@Context Application app) {
>> ...
>> }
>>
>> Nor into a resource method parameter:
>>
>> @GET
>> public Response myResourceMethod(@Context Application app) {
>> ...
>> }
>>
>> When Jersey instantiates the Application class an error is reported respectively:
>>
>> SEVERE: The following errors have been detected with resource and/or provider classes:
>>
>> SEVERE: Missing dependency for field: javax.ws.rs.core.Application MyResource.app
>>
>> SEVERE: Missing dependency for constructor public MyResource(javax.ws.rs.core.Application) at parameter index 0
>>
>> SEVERE: Missing dependency for method public Response MyResource.myResourceMethod(javax.ws.rs.core.Application) at parameter at index 0
>>
>> The variable intended for being injected (app) remains null.
>>
>> Injection of other context, e.g. @Context UriInfo works well.
>> Just @Context Application doesn't work (as described in JSR-311 specification, section 5.2.1).
>>
>> Do (or understand) I something wrong?
>>
>> Tested with Jersey 1.3-SNAPSHOT (May 27).
>>
>> Cheers,
>> Jörg
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
>> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net