Dependency Injection in Android With Dagger2 (2)
Replace Pure Dependency Injection with Dagger2
Previous post we set up the so called Pure Dependency Injection. Now let’s replace that with Dagger2 balantly.
Convert the composition roots into dagger’s @Module
s.
Create @Component
to hold each @Module
.
Create @Scope
s and use it to scope the objects we want only 1 instance in the component.
Now it looks like this:
Share this post
Twitter
Google+
Facebook
Reddit
LinkedIn
StumbleUpon
Email