Dagger 2, as explained on GitHub, is a compile-time evolution approach to dependency injection. Taking the approach started in Dagger 1.x to its ultimate conclusion, Dagger 2.x eliminates all reflection, and improves code clarity by removing the traditional ObjectGraph
/Injector
in favor of user-specified @Component
interfaces.
Dagger 2 exposes a number of special annotations:
@Module for the classes whose methods provide dependencies
@Provides for the methods within @Module classes
@Inject to request a dependency (a constructor, a field, or a method)
@Component is a bridge interface between modules and injection
GitHub: https://github.com/google/dagger
UserGuide(Google): https://google.github.io/dagger/users-guide.html
Videos: https://google.github.io/dagger/resources.html
Vogella Tutorial: http://www.vogella.com/tutorials/Dagger/article.html
Codepath Tutorial: https://github.com/codepath/android_guides/wiki/Dependency-Injection-with-Dagger-2