I am trying the DI toothpick library and it seems to be missing something.
I created the following test project on GitHub, where I tried to make the smallest possible use for my understanding of the problem.
There you will find the ApplicationModule where I am trying to inject everything I need into my “root” module. As you can see, I have it twice scope.installModules(module)
because mine PlainPojo
is instance dependent Application
. If I do not make the first call installModule
, I do not have an application instance in the scope. I could, as mentioned in the comment, pass the application instance as a parameter, but I thought I could remove them when I use DI?
The second class that causes the problems is the SimpleTest class . Unless I call the inject method inject()
in the constructor, the PlainPojo element will not be entered. I also tried a third time using installModules()
in ApplicationModule
after binding PlainPojo, but this does not help.
Am I not right in assuming that it is @Inject
enough for a member to automatically implement it when it is available in the scope, and that the binding order is sufficient to make the previous bindings available without setting between them (how is this done in ApplicationModule
)?
If I can provide something else to make my problem understandable, please leave a comment.
Thanks in advance!
source
share