Comment by drew.mclaughlin:

No.

An untargetted binding simply tells the injector that whenever an instance of MyConcreteClass is requested it should create one and inject it. Whereas the provides method tells the injector that this method should be invoked whenever an instance of MyConcreteClass is requested and use the returned value to inject.

The key difference is that the instance will be created by Guice in one case and by your code in the other. There are a few things that will only work for instance created by Guice - AOP method interception being the main one.

In general I'd recommend that you only use provider methods when you've got non-trivial logic required to create the instance. Usually this means that you'll have a non-zero number of parameters to the provider method that you'd use to create the instance.


For more information:
http://code.google.com/p/google-guice/wiki/UntargettedBindings

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

Reply via email to