Greetings, Currently, My task is to implement the dagger 2 in apache taverna mobile. So, in the dagger, there is a dependency consumer which asks for the dependency(Object) from a dependency provider through a connector. In dependency consumer, we use @Inject to define the dependencies. So, in our project, I have initialised all the dependencies which were used in the classes in a single file and now they were globally initialized. Now every class can take all its dependencies from outside.
And in dependency provider, Classes annotated with @Module are responsible for providing objects which can be injected. Such classes define methods annotated with @Provides. The returned objects from these methods are available for dependency injection. So, I have annotated all the classes with @Module and defined the methods with @Provides. So, now I am connecting consumer and producer. A @Component annotated interface defines the connection between the provider of objects (modules) and the objects which express a dependency. The class for this connection is generated by the Dagger. After learning about the dagger 2 I found some limitations about it:- 1) Dagger2 does not inject fields automatically. 2) It cannot inject private fields. 3) If you want to use field injection you have to define a method in your @Component annotated interface which takes the instance of the class into which you want to inject the member variable. So, this is the current status of the project development and I have also written the weekly blog on the dagger 2. Please feel free to give any suggestions. I will be grateful for your valuable insights. -- Regards, *Hitesh Gautam <https://www.linkedin.com/in/hitesh-gautam-84752a148/>* B.Tech (Information Technology and Mathematical Innovation) Cluster Innovation Centre New Delhi | India Ph :- +91 8383848780
