Library Dagger 2 Dependency Injection in Applications

suggest change

Versions

[{“Name”:“3.0.x”,“GroupName”:null},{“Name”:“3.1.x”,“GroupName”:null},{“Name”:“3.2.x”,“GroupName”:null},{“Name”:“4.0”,“GroupName”:null},{“Name”:“4.0.3”,“GroupName”:null},{“Name”:“4.1”,“GroupName”:null},{“Name”:“4.2”,“GroupName”:null},{“Name”:“4.3”,“GroupName”:null},{“Name”:“4.4”,“GroupName”:null},{“Name”:“4.4W”,“GroupName”:null},{“Name”:“5.0”,“GroupName”:null},{“Name”:“5.1”,“GroupName”:null},{“Name”:“6.0”,“GroupName”:null},{“Name”:“7.0”,“GroupName”:null},{“Name”:“7.1”,“GroupName”:null}]

Introduction

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.

Remarks

  1. Library setup in application(for maven, gradle,java projects)
  2. Advantages of Dragger use
  3. Important Links (for Documentation and demos)
  4. How to integrate and use Dragger components

Dagger 2 API:

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

Important Links:

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

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents