mirror of
https://github.com/mbierlee/poodinis.git
synced 2024-11-15 04:04:01 +01:00
Deprecate buggy work-around in favor of qualifiers
This commit is contained in:
parent
2aef9a1760
commit
77cc636e7f
|
@ -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
|
||||||
|
|
19
README.md
19
README.md
|
@ -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
|
||||||
-----------
|
-----------
|
||||||
|
|
|
@ -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);
|
||||||
|
|
Loading…
Reference in a new issue