You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Problem
HealthManager class creates the injector instance and tries to create the metrics provider class using this. What this means is that the metrics provider constructor must itself depend on a lot of concrete dependencies.
This makes testing difficult.
We cannot use annotation binding in our classes.
There are probably more such disadvantages.
Example
Consider the following definition.
@Inject
public BasicPolicy(Config sysConfig, Dependency1 dep1){
Here Dependency1 must be a concrete class (with its own inject annotations) for health manager to properly create its instance. There could be a workaround by having it as Dependency1Factory however this is again concrete and defeats the purpose of DI.
Ask
Provide a mechanism to register user defined modules in the HealthManager. For example. an IPolicyBindings with getBindings()getModules() and then that can be applied to the injector by the HealthManager class before attempting to create the metrics provider instance.
The text was updated successfully, but these errors were encountered:
Problem
HealthManager class creates the injector instance and tries to create the metrics provider class using this. What this means is that the metrics provider constructor must itself depend on a lot of concrete dependencies.
There are probably more such disadvantages.
Example
Consider the following definition.
Here
Dependency1
must be a concrete class (with its own inject annotations) for health manager to properly create its instance. There could be a workaround by having it asDependency1Factory
however this is again concrete and defeats the purpose of DI.Ask
Provide a mechanism to register user defined modules in the HealthManager. For example. an
IPolicyBindings
withgetBindings()
getModules()
and then that can be applied to the injector by the HealthManager class before attempting to create the metrics provider instance.The text was updated successfully, but these errors were encountered: