From 77cc636e7fff4256396d5b594605b3678d5a547b Mon Sep 17 00:00:00 2001 From: Mike Bierlee Date: Sun, 14 Dec 2014 19:23:01 +0100 Subject: [PATCH] Deprecate buggy work-around in favor of qualifiers --- CHANGES.md | 1 + README.md | 19 +------------------ source/poodinis/autowire.d | 1 + 3 files changed, 3 insertions(+), 18 deletions(-) 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);