-
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
Change ContextSingleton retention policy to RUNTIME #196
Comments
Hi @zawadz88 , Thanks for the issue. This class was meant to be there just as an example. However, the javadoc is not really clear and probably the class is not useful either. Therefore, we will deprecate the class, change the retention and update the javadoc. If you are using context singletons, please create the annotation yourself and bind it to the right scopes: |
I would add that But, later, we just removed it. The issue is that when you So, definitely ContextSingleton is more a simple example of a custom annotation but it should not be used in a production app. At Groupon, we use instead |
Thanks for the clarification and sorry for the misclick ;) |
I was searching how to inject the |
If you install the smoothie application module in your app scope, then you can simply use All the docs of TP is in the wiki in the repo... @HugoGresse |
@HugoGresse were you able to do it? |
@HugoGresse there are 2 things you can do with TP, and I believe it's the same with dagger / Roboguice:
class Foo {
Bar bar;
@Inject
public Foo(Bar bar) {
bar.bar(); // <-- would work as long as TP knows how to create the instance of Bar
}
class Foo {
@Inject Bar bar;
@Inject
public Foo() {
bar.bar(); // <-- would fail because members are not initialized yet, see the factory code.
}
@Inject
void init() {
bar.bar(); // <-- would work
}
} |
Release 1.0.8 will solve this issue. |
Hi,
First of all thanks for the great library!
Recently, I tried updating toothpick from 1.0.3 to 1.0.5 in my Android project and got:
Error:Scope Annotation toothpick.smoothie.annotations.ContextSingleton does not have RUNTIME retention policy.
during compilation.I checked and
ContextSingleton
from smoothie has runtime policyCLASS
currently unlike e.g. Singleton from javax.inject or the custom scope in smoothie-sample which probably causes this error. This is probably due to the changes in #191Could you help please?
The text was updated successfully, but these errors were encountered: