Thanks Sam, but doesn't that force explicit bindings for all classes? I take it there's no way to prohibit bindings to just a handful of classes? I suppose I could make a provider method that throws a runtime exception?
On Thursday, July 19, 2012 11:24:10 AM UTC-5, Sam Berlin wrote: > > Binder.requireExplicitBindings > > On Thu, Jul 19, 2012 at 12:20 PM, glenviewjeff wrote: > >> Also posted on Stack Overflow<http://stackoverflow.com/q/11564353/403455> >> >> 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-guice@googlegroups.com. >> To unsubscribe from this group, send email to >> google-guice+unsubscr...@googlegroups.com. >> For more options, visit this group at >> http://groups.google.com/group/google-guice?hl=en. >> > > -- 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/-/VBkey9i7yKYJ. To post to this group, send email to google-guice@googlegroups.com. To unsubscribe from this group, send email to google-guice+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-guice?hl=en.