diff --git a/source/poodinis/container.d b/source/poodinis/container.d index 61037a3..49651a7 100644 --- a/source/poodinis/container.d +++ b/source/poodinis/container.d @@ -373,6 +373,7 @@ synchronized class DependencyContainer { auto context = new Context(); context.registerDependencies(this); context.registerContextComponents(this); + this.register!(ApplicationContext, Context)().existingInstance(context); autowire(this, context); } diff --git a/test/poodinis/containertest.d b/test/poodinis/containertest.d index 61490fb..67d7e52 100644 --- a/test/poodinis/containertest.d +++ b/test/poodinis/containertest.d @@ -589,4 +589,11 @@ version(unittest) { assert(instance.wrapper is wrapper); assert(instance.wrapper.someClass is someClass); } + + // Test resolving registered context + unittest { + shared(DependencyContainer) container = new DependencyContainer(); + container.registerContext!TestContext; + container.resolve!ApplicationContext; + } }