Remove deprecated "autowire in constructor"

This commit is contained in:
Mike Bierlee 2015-02-15 14:52:01 +01:00
parent 67ea3a82c9
commit e44cdf276a
2 changed files with 0 additions and 29 deletions

View file

@ -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) { public void globalAutowire(Type)(Type instance) {
DependencyContainer.getInstance().autowire(instance); DependencyContainer.getInstance().autowire(instance);
} }

View file

@ -39,13 +39,6 @@ version(unittest) {
public ComponentC componentC; public ComponentC componentC;
} }
class ComponentF {
@Autowired
public ComponentA componentA;
mixin AutowireConstructor;
}
class ComponentDeclarationCocktail { class ComponentDeclarationCocktail {
alias noomer = int; 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"); 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 // Test autowire class with alias declaration
unittest { unittest {
auto container = new DependencyContainer(); auto container = new DependencyContainer();