dagger
A fast dependency injector for Android and Java.
A deprecated Java and Android library from Square that automatically wires up dependencies between classes at build time. Replaced by Dagger 2, only useful today for maintaining legacy codebases.
Dagger 1 is a deprecated Java and Android library from Square that handled dependency injection, which is a programming pattern for automatically supplying objects with the other objects they need to function. Rather than having each class manually create or locate its dependencies, a dependency injection framework wires everything together at build time or startup.
This repository is no longer actively maintained. Square and Google jointly moved to Dagger 2, which is a separate project hosted under Google's GitHub account. The README explicitly directs anyone still using this version to migrate, and provides a link to a migration guide.
For anyone who needs to work with the old version for legacy reasons, it was distributed as two jar files: a runtime jar that ships with the application, and a compiler jar used only during the build process to generate the wiring code. Installation instructions are provided for Maven-based projects, and the compiled jars were also available on Maven Central.
The primary audience for this repository today would be developers maintaining older Android or Java applications that have not yet upgraded to Dagger 2, or historians of Java tooling interested in how dependency injection evolved in the Android ecosystem. New projects should not use this version.
Where it fits
- Maintain a legacy Android or Java app that still depends on Dagger 1 without migrating to Dagger 2 yet
- Study how early Android dependency injection worked before Dagger 2 existed
- Add the two Dagger 1 Maven Central jars to an existing Maven project to get dependency injection running