mirror of
https://github.com/mbierlee/poodinis.git
synced 2024-11-15 04:04:01 +01:00
Remove deprecated "autowire in constructor"
This commit is contained in:
parent
67ea3a82c9
commit
e44cdf276a
|
@ -72,13 +72,6 @@ public void autowire(Type)(DependencyContainer container, Type instance) {
|
|||
}
|
||||
}
|
||||
|
||||
deprecated("Please use qualifiers instead")
|
||||
mixin template AutowireConstructor() {
|
||||
public this() {
|
||||
globalAutowire(this);
|
||||
}
|
||||
}
|
||||
|
||||
public void globalAutowire(Type)(Type instance) {
|
||||
DependencyContainer.getInstance().autowire(instance);
|
||||
}
|
||||
|
|
|
@ -39,13 +39,6 @@ version(unittest) {
|
|||
public ComponentC componentC;
|
||||
}
|
||||
|
||||
class ComponentF {
|
||||
@Autowired
|
||||
public ComponentA componentA;
|
||||
|
||||
mixin AutowireConstructor;
|
||||
}
|
||||
|
||||
class ComponentDeclarationCocktail {
|
||||
alias noomer = int;
|
||||
|
||||
|
@ -119,21 +112,6 @@ version(unittest) {
|
|||
assert(componentE.componentC is null, "Autowiring should not occur for members with attributes other than @Autowire");
|
||||
}
|
||||
|
||||
// Test autowire in constructor
|
||||
unittest {
|
||||
auto container = DependencyContainer.getInstance();
|
||||
container.register!ComponentA;
|
||||
auto componentF = new ComponentF();
|
||||
auto autowiredComponentA = componentF.componentA;
|
||||
container.register!(ComponentF).existingInstance(componentF);
|
||||
assert(componentF.componentA !is null, "Constructor did not autowire component F");
|
||||
|
||||
auto resolvedComponentF = container.resolve!ComponentF;
|
||||
assert(resolvedComponentF.componentA is autowiredComponentA, "Resolving instance of ComponentF rewired members");
|
||||
|
||||
container.clearAllRegistrations();
|
||||
}
|
||||
|
||||
// Test autowire class with alias declaration
|
||||
unittest {
|
||||
auto container = new DependencyContainer();
|
||||
|
|
Loading…
Reference in a new issue