-
Notifications
You must be signed in to change notification settings - Fork 114
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
Scoped bindings not reusing instances? #149
Comments
Hi @philipbjorge, first, thx for submitting the issues and the PR. We have been on vacations and were pretty busy when coming back, we had no time to dedicate to TP. We have been talking with @dlemures about the issue you raised. For this one, you are right, there is a problem in the docs. Actually the issue is not so easy. We could feel a point of tension in TP and the guice API for bindings as a binding holds 3 different informations:
We introduced the method We want to fix that and get an API that allows programmatically to do all possible operations on bindings, independently of annotations. Annotations are more a syntactic sugar in our idea of TP. So, we want to introduce the following changes:
What do you think of our plan ? |
will be shipped in RC 10 |
Docs on Scoped/Unscoped Bindings
bind(OkHttpClient.class).toProvider(OkHttpClientProvider.class).scope();
This creates a new instance every injection, which makes me think AND the same instance of Foo is recycled/reused for each injection of IFoo is not accurate any more? Is that true?
It looks like I will want to use a combination of
@Scope
and@ScopeInstances
to accomplish the same effect now.The text was updated successfully, but these errors were encountered: