-
-
Notifications
You must be signed in to change notification settings - Fork 19
Open
Labels
component:dependency-injectionkind:bugAn existing feature isn't working as expectedAn existing feature isn't working as expectedstate:blocked
Description
A service that depends on an interface cannot receive additional injected implementations of the interface when the first implementation is a Struct and the additional implementation is a Class
module Interface
abstract def foo
end
@[ADI::Register]
@[ADI::AsAlias(Interface)]
struct Dependency
include Interface
def foo
return "Dependency"
end
end
@[ADI::Register]
@[ADI::AsAlias(Interface)]
class InjectedDependency
include Interface
def foo
return "Injected Dependency"
end
end
@[ADI::Register(public: true)]
class Service
def initialize(@service : Interface)
end
def run
return @service.foo
end
end
puts ADI.container.service.run # => "Dependency"Metadata
Metadata
Assignees
Labels
component:dependency-injectionkind:bugAn existing feature isn't working as expectedAn existing feature isn't working as expectedstate:blocked