1. @Module This annotation is used over the class which is used to construct objects and provide the dependencies.
  2. @Provides This is used over the method in the module class that will return the object.
  3. @Inject This is used over the fields, constructor, or method and indicates that dependencies are requested.
  4. @Component This is used over a component interface that acts as a bridge between @Module and @Inject. (Module class doesn’t provide dependency directly to requesting class, it uses component interface)
  5. @Singleton This is used to indicate only a single instance of dependency object is created.
  • Constructor Injection: Injecting the method parameters.
  • Field Injection: Injecting the member variable (must not be private).
  • Method Injection: Injecting the method parameter.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Prachi Mishra

Prachi Mishra

I am an Android Developer. Working for BMW group. In my development path if I find something interesting I like to share with you guys. Happy coding…