Open AKJAW opened 2 months ago
includes operator loads the definition you would like to overloadwith?
In my opinion that depends on the placement of includes
includes(defaultModuleVal)
factoryOf(::OverriddenImplementation) bind SomeInterface::class
should result in OverriddenImplementation being bound
when includes is last
factoryOf(::OverriddenImplementation) bind SomeInterface::class
includes(defaultModuleVal)
then DefaultImplementation should be bound
That's the assumption from the documentation, whatever is declared later should override whatever came before
Describe the bug
Having the following code:
When we want to override the deafult implementations for some flavors of our Application.
In the following way:
Does not override the declaration, the graph will still use the default implementation.
In order to fix the issue, instead of
includes
, a Module. extension function could be usedTo Reproduce You can use the code above to reproduce the issue.
Expected behavior using
includes
should attach the dependencies in the same place where it is declared, so declaring / overriding dependencies after theincludes
should work as expected.Or there should be an explicit way of declaring overriding dependencies (like it was before).
Because as it is now, it can cause hidden issues.
Koin module and version: koin-core 3.5.3 and 3.5.6
Snippet or Sample project to help reproduce