Closed Janekdererste closed 1 month ago
Just a quick guess: The QSimModule has various subordinate AbstractQSimModule that are bound when the moduel is installed. And they, traditionally contain various asEagerSingleton. So if the QSimModule would be installed by default, all these object trees would be generated by default, even though they may never be used. This is especially tricky if certain components in the scenario etc. are maybe not even there because one just wants to set up an injector without a QSim. So I would assume that it was easier to do it this way than to resolve all the unneeded eager bindings.
@michaz (if he reads this) should know better than me. My own guess is that installing the QSim is more involved (i.e. needs several bindings), and so they are grouped into a separate AbstractModule. (In my understanding, nested installs do not have any meaning ... the bindings are all at the same level.) Could as well move the other bindings into Modules of their own. I don't think that this has anything to do with eager singletons; in fact, every time I see them I try to replace them by in( Singleton.class )
scope.
But maybe I am misunderstanding your question, sorry.
Thanks for your answers, I think this goes into the right direction. With your remarks, I can now see, that the QSimModule
eventually also calls bind(Mobsim.class).to(QSim.class)
, which is what the others are essentially doing. I guess this also means that the other Mobsim
implementations are less configurable and have to be used as is.
The
DefaultMobsimModule
below, has different code paths for different implementations of themobsim
. I would like to understand, why theQSimModule
isinstalled
but the other modules are injected using `bindMobsim().to(...)?Maybe @kainagel remembers why?