On Jan 7, 2010, at 3:31 PM, Dhanji R. Prasanna wrote:

> 
> 
> On Tue, Jan 5, 2010 at 9:14 PM, eric <[email protected]> wrote:
> Hi,
> 
> I've read this,
> http://code.google.com/p/google-guice/wiki/InjectionPoints
> 
> and I've added my own injectors. Everything works fine.
> 
> BUT, I would like to inject members before calling the constructor
> body, something  like field initializer are called before constructor
> body is called.
> 
> This is not possible without rewriting the class itself.

Just to expand. That is a feature of Java. The constructor is guaranteed to run 
before an instance of the class is accessible to anything else. Therefore, you 
can't call methods on any Object until the constructor has completed. This 
ensures safety of construction and memory access. Also helps with threading.

-bp



--
You received this message because you are subscribed to the Google Groups "google-guice" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to [email protected].
For more options, visit this group at http://groups.google.com/group/google-guice?hl=en.

Reply via email to