users@jersey.java.net

Re: [Jersey] Re: Can't get _at_Context Application be injected

From: Paul Sandoz <Paul.Sandoz_at_oracle.com>
Date: Mon, 2 Aug 2010 13:26:12 +0200

On Aug 2, 2010, at 1:21 PM, Johannes Schade wrote:

>
> Dear Paul
>
> I see my error now thanks to the explanation in your email. I tried to
> access an injected class field in the constructor. This will never
> work
> because the field is not yet assigned at the time the constructor is
> executed.
>
> My fault
>

No problem. This is quite a common mistake.

The ideal behavior is what you would expect but since IoC frameworks
are layered on top of the JVM they do not have special access/control
of construction. I wish there was a way because this could remove
limitations of field injection and perhaps those of class proxies (a
default constructor is required).

Paul.