Dagger 2 Generic Type class inject error

I have run into the same issue and found this article.

In a nutshell you have this options:

  1. Make not generic wrapper class containing injected fields, make it to be a field of your class and inject it instead of generic class itself.
  2. Inject child non-generic class instead of base class. All annotated with @Inject fields of base class will be also injected, but they have to be public/protected that is not good.
  3. Make annotated with @Inject setter in the base class and private field. Injecting child non-generic class will lead to triggering the setter with parameter got from the object graph.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)