From the dagger 2 Documentation I noticed that you can have a @Singleton
annotated class. What is the purpose of marking a class as @Singleton
as I hav
@Singleton
(and any other scope annotation) makes your class a single instance in your dependencies graph (it means that this instance will be "singleton" as long as Component object exists).
In short - everytime you're injecting @Singleton
annotated class (with @Inject
annotation) it will be the same instance as long as you inject it from the same Component.
For more I'm referring my blog post about how @Singleton
and other scopes annotations works in Dagger 2: http://frogermcs.github.io/dependency-injection-with-dagger-2-custom-scopes/