Fields can only be injected after the class has been instantiated. Thus all 
injected fields are still null during constructor execution. Either 
refactor your code so you don't need to access the field right away in the 
constructor or use constructor injection instead. IMHO constructor 
injection pretty much always wins against field injection. This makes 
dependencies explicit and you can still use the class without any injection 
framework.

If you don't want to type all the "this.var = injectedVar" inside the 
constructor then first type your fields and then let your IDE generate the 
constructor.

-- J.

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to