stephanenicolas / toothpick

A scope tree based Dependency Injection (DI) library for Java / Kotlin / Android.
Apache License 2.0
1.12k stars 115 forks source link

Clarification needed about Scope annotation #417

Open afaucogney opened 4 years ago

afaucogney commented 4 years ago

Could you maybe rephrase the definition, or the target of the feature, because I do not understand well how it does work and for what purpose it is !

the doc says : https://github.com/stephanenicolas/toothpick/wiki/Scope-Annotations

Annotating Bar with @ActivityScope means "All instances of Bar should belong to a scope that supports the scope annotation @ActivityScope". All the dependencies of Bar will also be found in such a scope or its parents.

As an example, if we take an app with 2 activities, that owns a dedicated scope.

Did I understand it ?

Could someone give more operationnal / industrial use cases about this ?