override
Mark this definition as allowing override, even when global allowOverride is false. Used within withOptions { } block.
This enables targeted overrides for specific definitions without opening up all definitions to be overridden globally.
Example:
koinApplication {
allowOverride(false) // Strict mode - no overrides by default
modules(
module { single { ProductionService() } },
module {
single { TestService() } withOptions {
override() // Only this definition can override
}
}
)
}Content copied to clipboard