Dependency Injection with Dagger 2
Creating the Application Component Interface
Up next
Previous
About
We're ready to dive into Dagger 2 with the Application Component. This is the "top level" Singleton Component. We'll go over what a Component is, and how to define the interface for one, which Dagger 2 will use to generate an implementation.
Instructor
Links
Comments
Hi Steve!
@BindsInstance
is a way to bind an instance of a dependency into the Dagger graph (make it injectable elsewhere) without needing to use a Module
.
Here, we are telling Dagger that if any other object, injected by this Component, injects a Context
(the type of the parameter), then give them this instance context
(the value we pass when calling the Factory create method).
There will be more uses of this throughout the course which should help to solidify the concept in your mind.
Main takeaway is this is shorthand for providing a dependency without using a Module
.
Lessons in Dependency Injection with Dagger 2






















































