Hi Johannes,
There are some restrictions on injecting onto an instance of
Application because an such an instance needs to be obtained before
Jersey can initiate properly. The restrictions relate to injected
artifacts associated with providers.
However, the types ServletConfig and ServletContext should be
supported as well as the ResourceConfig that is used at
initialization. There is a unit test that explicitly tests that
ServletConfig can be injected.
I think the fact that you get null implies you may not be using 1.3 as
you should get an error stating the injection failed rather than null.
Paul.
On Jul 27, 2010, at 12:04 PM, Johannes Schade wrote:
>
> Dear Joerg
> Thank you very much for your post. I had the same problem (in
> version 1.1.5)
> and did not realise it was a bug. I saw your post, downloaded
> version 1.3
> and could inject the application into a resource, which solved a big
> problem
> for me. Thank you very much and Paul as well of course!
> However, there seems to be a similar problem when trying to inject the
> ServletConfig, the ServletContext or the ResourceConfig on a
> application. I
> made an application subclass and applied @Context ServletContext as
> a class
> field and received a null. Perhaps that this is also a bug?
>
> Best regards, Johannes
>
> --
> View this message in context: http://jersey.576304.n2.nabble.com/Can-t-get-Context-Application-be-injected-tp5128719p5341527.html
> Sent from the Jersey mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>