Answer the question
In order to leave comments, you need to log in
Is there a configurable DI for golang?
Hello everyone, I ran into such a problem: during the start of the application, it is necessary to resolve a huge number of dependencies between the main components of the system. At the same time, some of them need to be able to be configured at the time of launch, and not at the build stage to set parameters.
Following the link , I sketched an approximate structure of components, some of them are optional, some are interchangeable. I did not make links through yaml aliases in order to preserve the structure with a minimum number of levels. "%...%" is a reference to another component.
Actually, a certain DI container is required that could resolve dependencies in lazy-load mode, while not compiling hard into a binary, but requesting its settings dynamically.
Here is this golangit/dicalready poked, with private properties it didn’t start + requires a rigid system of dependencies. Of course, you can add parsing of the same yaml (viper for example) and do it dynamically, but then it’s already easier to write all these calls by hand.
Of course, such a thing must have some register of constructors.
To summarize, have you encountered similar problems, how did you solve them? Is there something ready?
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question