python-dependency-injector
python-dependency-injector copied to clipboard
Eager provider/container initialization
Im curious if there is a reason that "lazily" loading dependencies is the only way to load any kind of provider (with the exception of Resources)
I think it makes sense to fail fast with regards to dependencies.
For example:
If there is a connection issue in a dependency that makes a web request on creation, i'd rather my app fail immediately than N amount of time later when that dependency is used.
Im writing this issue to see if other folks have written workarounds to eagerly initialize all of a projects dependency at Container creation time. Or maybe there is a good reason to avoid this. Its certainly standard to eagerly load dependencies in Java Spring.
There is a traversal method that is available that could make the manual way doing this a little easier.