mirror of
https://github.com/mbierlee/poodinis.git
synced 2024-11-15 04:04:01 +01:00
Register application contexts as a resolvable dependency
For those who like to play with fire
This commit is contained in:
parent
f206b594c8
commit
d310640717
|
@ -373,6 +373,7 @@ synchronized class DependencyContainer {
|
||||||
auto context = new Context();
|
auto context = new Context();
|
||||||
context.registerDependencies(this);
|
context.registerDependencies(this);
|
||||||
context.registerContextComponents(this);
|
context.registerContextComponents(this);
|
||||||
|
this.register!(ApplicationContext, Context)().existingInstance(context);
|
||||||
autowire(this, context);
|
autowire(this, context);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -589,4 +589,11 @@ version(unittest) {
|
||||||
assert(instance.wrapper is wrapper);
|
assert(instance.wrapper is wrapper);
|
||||||
assert(instance.wrapper.someClass is someClass);
|
assert(instance.wrapper.someClass is someClass);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Test resolving registered context
|
||||||
|
unittest {
|
||||||
|
shared(DependencyContainer) container = new DependencyContainer();
|
||||||
|
container.registerContext!TestContext;
|
||||||
|
container.resolve!ApplicationContext;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue