On Wed, Mar 3, 2010 at 4:34 PM, infinity2heaven <[email protected]>wrote:

> Got it. Wasn't quite intuitive in the beginning but it seems like a
> "Module" is analogous to a <bean-id> in spring.


No, it's more like the entire xml file.


> So if you have 25
> beans that refers a single bean, "foo", you have a reference for foo
> in all those beans. However, to reduce the boilerplate code, Spring
> provides autowire(byType or byName). Is there a similar feature in
> Guice.
>

Actually, you can think of everything in Guice as being "Autowired".
Strictly speaking, if you have no interfaces, you don't need any modules and
can just call getInstance() on any class directly, so long as the
appropriate @Inject annotations are present.

You would have the same problem in Spring with the test not being injected.
The problem is that your test is created by Junit, rather than by Guice, and
Junit knows nothing about injection.

Dhanji.

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