Paul Woitaschek
11/19/2018, 5:27 PMPaul Woitaschek
11/21/2018, 2:02 PMRecipeComponent
. Now this recipe component needs to depend on dependencies from my AppComponent
.
So far - fine, no problems.
Now in my App I want to show a RecipeOverviewFragment
, so my app needs to have a dependency on the recipe
dagger module.
How do you overcome this circularity?RecipeComponent
not depend on the AppComponent
but rather expose all it's dependencies through a `bindsInstance' method.
But there are like 10 of them so this scales not too well.David
11/21/2018, 2:22 PM@BindsInstance
you allude to) but in the cases where I am modularising I am never binding anything more than Context
to a child module as part of the @dagger.Component
construction.app
and recipe
(gradle) modules have a dependency on the this base component?@ApplicationScope
or `@Singleton`….Paul Woitaschek
11/21/2018, 2:30 PMI suspect you are going to say analytics, retrofit, okhttp and many other “true” read-only singletons.
David
11/21/2018, 2:31 PMrecipe
a dependency on app
) then you’d need to work as subcomponents do. If on the other hand you “push down” (notice ‘dumb’ modules that contain POJO & POKOS in :model
and analytics
in particular are right at the bottom of the graph) then you can use the @dagger.Component
construct to control what is exposed to consumer modules.Paul Woitaschek
11/21/2018, 2:43 PMDavid
11/21/2018, 2:49 PM