What is Root Container Resolution in Aurelia?
Imagine that we have a single instance of Container called root
. If a developer (or Aurelia) invokes root.get(A)
to resolve an instance of A
, the root will first check to see if it has a Resolver for A
. If one is found
, the Resolver is used to get the instance, which is then returned to the developer. If one is not found, the container will auto-register
a Resolver for A
. This resolver
is configured with a singleton lifetime behavior. Immediately after auto-registration
, the Resolver is used to get the instance of A
which is returned to the developer. Subsequent calls to root.get(A)
will now immediately find a Resolver for A
which will return the singleton instance.