The work of Injector is to construct the Object Graph. When you call getInstance to construct an Object of a certain type, Injector will automatically create instances of the required classes based on the dependencies between classes.
The method for defining dependencies between classes is to extend the AbstractAndroidModule and reload its configure method. Define various Bindings in the configure method. These methods also perform type detection. If the type used is incorrect, the compiler will give an error.
Bindings can be bound to the following types:
Linked bindings
Instance bindings
@ Provider methods
Provider bindings
Constructor bindings
Untargetted bindings
Built-in bindings
Just-in-time bindings
Providers, etc.
Later, we will introduce these bindings one by one. These bindings are common and have little relevance with the Android platform. They can be used on both Java EE and Java SE platforms. RoboGuice provides dependency injector related to the Android platform, we will also provide a detailed description later.