Two @injects In One Object But From Two Different Components
I have: @Inject AdalService adalService; @Inject Realm realm; Both of these come from two different Components. AdalComponent @UserScope @Component(dependencies = {NetComponent.c
Solution 1:
Inside AdalServiceComponent
and RealmComponent
you have the same method:
voidinject(EventsJob eventsJob);
That is unacceptable. The must be only one inject
method for specified object (argument of inject
method).
Also you can't inject things from two moduled at the same level. Both Component
's are annotated with the same Scope: @UserScope
. They don't know nothing about each other. If you want to define resources in AdalServiceComponent
and RealmComponent
make one of them parent Component
and the other one Subcomponent
. And the inject
method should be in subcomponent.
Please read this excellent article series about advanced Dagger-2 behaviour to gain better understanding of this library.
Post a Comment for "Two @injects In One Object But From Two Different Components"