Hi everyone
I am using koin wuth koin-annotations. Now I am Adding a logger and want to have a factory, that I can pass a tag, that creates a new logger with that tag. This I achieve with the following code:
Copy code
@Factory
fun provideLogger(@InjectedParam tag: String?): Logger {
return if (tag != null) logger.withTag(tag) else logger
}
Now I am wondering, how I can pass the tag when creating for example a singleton:
Copy code
@Single
class SomeService(logger: Logger) { ... }
Is there any solution to this?
f
François
08/31/2025, 2:12 PM
CurrentIy, Koin annotation can’t support parameter injection directly, you need to use the dsl way to inject some value