diff --git a/CHANGES.md b/CHANGES.md index aba36eb..d177e19 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -2,6 +2,7 @@ Poodinis Changelog ================== **Version 0.2.0** * ADD ability to register type with multiple concrete types. They can be correctly resolved using qualifiers. +* DEPRECATE template for autowiring in constructor. This workaround is buggy. Use qualifiers instead. **Version 0.1.4** * Make Poodinis compatible with D 2.066.0 and DUB 0.9.22 diff --git a/README.md b/README.md index 83b778b..5584b16 100644 --- a/README.md +++ b/README.md @@ -141,24 +141,7 @@ If you registered multiple concrete types to the same supertype and you do not r Known issues ------------ -* Resolving a class registered by supertype or interface will only autowire the members inherited from its supertypes and in the case of interfaces none at all. A workaround for this issue is to autowire members in the constructor of a class: -```d -import poodinis.autowire; - -class ComponentF { - @Autowire - public ComponentA componentA; - - public this() { - globalAutowire(this); - } - - // or use: - // mixin AutowireConstructor; - // which adds the constructor above -} -``` -This method will not work for circular dependencies registered with a singleInstance scope: new instances will still be created and assigned to these dependencies. +* Resolving a class registered by supertype or interface will only autowire the members inherited from its supertypes and in the case of interfaces none at all. To work around this issue, use a qualifier. See "[Registering and resolving using qualifiers](#Registering and resolving using qualifiers)". Future Work ----------- diff --git a/source/poodinis/autowire.d b/source/poodinis/autowire.d index 7eb36b8..8bf929d 100644 --- a/source/poodinis/autowire.d +++ b/source/poodinis/autowire.d @@ -70,6 +70,7 @@ public void autowire(Type)(DependencyContainer container, Type instance) { } } +deprecated("Please use qualifiers instead") mixin template AutowireConstructor() { public this() { globalAutowire(this);