Using Dagger for dependency injection on constructors

前端 未结 5 692
故里飘歌
故里飘歌 2021-01-31 17:17

So, I\'m currently redesigning an Android app of mine to use Dagger. My app is large and complicated, and I recently came across the following scenario:

Object A requir

5条回答
  •  太阳男子
    2021-01-31 17:42

    What Jake's post says is perfectly true. That said, we (some of the Google folk who work with Guice and Dagger) are working on an alternative version of "assisted injection" or automatic-factory generation which should be usable by Guice or Dagger or stand-alone - that is, it will generate factory class source code for you. These factory classes will (if appropriate) be injectable as any standard JSR-330 class would. But it is not yet released.

    Pending a solution like this, Jake Wharton's approach is advisable.

提交回复
热议问题