Deprecate buggy work-around in favor of qualifiers

This commit is contained in:
Mike Bierlee 2014-12-14 19:23:01 +01:00
parent 2aef9a1760
commit 77cc636e7f
3 changed files with 3 additions and 18 deletions

View file

@ -2,6 +2,7 @@ Poodinis Changelog
================== ==================
**Version 0.2.0** **Version 0.2.0**
* ADD ability to register type with multiple concrete types. They can be correctly resolved using qualifiers. * 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** **Version 0.1.4**
* Make Poodinis compatible with D 2.066.0 and DUB 0.9.22 * Make Poodinis compatible with D 2.066.0 and DUB 0.9.22

View file

@ -141,24 +141,7 @@ If you registered multiple concrete types to the same supertype and you do not r
Known issues 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: * 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)".
```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.
Future Work Future Work
----------- -----------

View file

@ -70,6 +70,7 @@ public void autowire(Type)(DependencyContainer container, Type instance) {
} }
} }
deprecated("Please use qualifiers instead")
mixin template AutowireConstructor() { mixin template AutowireConstructor() {
public this() { public this() {
globalAutowire(this); globalAutowire(this);