I'm using a couple of different injectors and I want to ensure I don't accidentally access a class that's bound automatically from an injector, especially since its scope is important.
Is there a way I can force an automatic binding to fail, or at least report a run-time error?
For instance if I have a method Foo that is "illegally" requesting a Bar:
class Bar { @Inject Bar() {} } // Shouldn't be accessible in Foo's injector
class Foo { @Inject Foo(Bar bar) {} } // Binding should fail here
--
You received this message because you are subscribed to the Google Groups "google-guice" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-guice/-/dPLIkgQMVngJ.
To post to this group, send email to google...@googlegroups.com.
To unsubscribe from this group, send email to google-guice...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-guice?hl=en.
Binder.requireExplicitBindings
On Thu, Jul 19, 2012 at 12:20 PM, glenviewjeff wrote:
Also posted on Stack OverflowI'm using a couple of different injectors and I want to ensure I don't accidentally access a class that's bound automatically from an injector, especially since its scope is important.
Is there a way I can force an automatic binding to fail, or at least report a run-time error?
For instance if I have a method
Foothat is "illegally" requesting a Bar:class Bar { @Inject Bar() {} } // Shouldn't be accessible in Foo's injector class Foo { @Inject Foo(Bar bar) {} } // Binding should fail here
--
You received this message because you are subscribed to the Google Groups "google-guice" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-guice/-/dPLIkgQMVngJ.
To post to this group, send email to google...@googlegroups.com.
To unsubscribe from this group, send email to google-guice+unsubscribe@googlegroups.com.
Ya, that sounds right.
sam
To view this discussion on the web visit https://groups.google.com/d/msg/google-guice/-/VBkey9i7yKYJ.
To post to this group, send email to google...@googlegroups.com.
To unsubscribe from this group, send email to google-guice...@googlegroups.com.