On Monday, May 30, 2011 7:11:17 PM UTC+2, Stefan wrote:
>
> Thanks Fred! 
> I didn't know that when using Guice I can't create objects via new 
> anymore.


Of course, you can, you just can't expect them to be created and filled by 
Guice. Most of the time, the best thing is the constructor injection (as in 
the example by Fred), as it allows you to make the fields final. There are 
other possibilities as well (e.g., method and field injection, and you can 
even `injectMembers` into objects created by yourself), but you hardly ever 
gonna need it.

-- 
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