roo-oliv/injectable

Autowired(List[...]) does not work with qualifiers

roo-oliv opened this issue · 0 comments

This script reproduces the bug:

from typing import List
from injectable import injectable, autowired, Autowired, InjectionContainer

@injectable(qualifier="foo")
class Foo:
    pass

@autowired
def test(foo: Autowired(List["foo"])):
    assert foo is not None
    assert len(foo) == 1

if __name__ == "__main__":
    InjectionContainer.load()
    test()

The returned error is quite cryptic:

AttributeError: '_ForwardRef' object has no attribute '__qualname__'