Hello, does koin support feature similar to dagger...
# koin
k
Hello, does koin support feature similar to dagger/hilt like injecting all classes of the same interface. I try to achieve this using koin-annotations, but ksp fails to provide set of dependencies with error about missing definition for property. What I am missing here?
Copy code
interface RequestParser

@Single
class AImpl : RequestParser

@Single
class BImpl : RequestParser

@Single
class Repository(private val parsers: Set<RequestParser>)
👀 2
k
let me try..
@Kazik share the same approach in dagger/hilt
k
Right now, I don't have any code snippet, but I remember that in hilt I can annotate dependencies with something like
@IntoSet
and then just inject set of all implementations for specific interface type.
I think the functionality is
lazy
by default but maybe if you create a custom module and add a function that returns a list of all your implementations.
k
Oh, I think find out. It seems it must be
List
instead of
Set
🤔 At least now compiles. Not sure if it will work in runtime without
Named
👍 1
j
I hope
@Named
isn't required but I've not personally tested it. Good luck
thank you color 1