Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

requireExplicitBindings() method should support requiring explicit binding on individual classes #716

Open
gissuebot opened this issue Jul 7, 2014 · 0 comments
Labels

Comments

@gissuebot
Copy link

From glenviewjeff on July 19, 2012 16:32:35

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.

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

Apparently, the only way to do this presently is to force a run-time error with a provider method.

I'd like Guice support to force an automatic binding to fail only on a specific class.  I think it could work via requireExplicitBindings() with variable length parameter list of classes to prohibit.

Original issue: http://code.google.com/p/google-guice/issues/detail?id=716

akhomchenko added a commit to akhomchenko/guice that referenced this issue Jun 14, 2020
akhomchenko added a commit to akhomchenko/guice that referenced this issue Jun 14, 2020
akhomchenko added a commit to akhomchenko/guice that referenced this issue Jun 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant