Reputation: 1383
Consider I have the following object graph:
AppComponent
scoped as @AppScope
(@Singleton
equivalent)SessionComponent
scoped as @SessionScope
, which is a subcomponent of AppComponent
SessionComponent
dependencies are being created (injected) at each session start.
Is it possible to inject @SessionScope
dependencies (provided at SessionComponent
) into @AppScope
dependencies (provided at AppComponent
)?
Vice versa is possible, as mentioned in Component
documentation:
The simplest way to relate two components is by declaring a
Subcomponent
. A subcomponent behaves exactly like a component, but has its implementation generated within a parent component or subcomponent. That relationship allows the subcomponent implementation to inherit the entire binding graph from its parent when it is declared.
I found that programmatically it is possible using this approach, but is it possible to do using only Dagger API?
Upvotes: 0
Views: 274