Skip to content
Ruedi Steinmann edited this page Mar 29, 2015 · 1 revision

how Salta creates Instances

Instance Creation

Creating instances is a recursive process. It starts with the request of the user for an instance of a specific type. While creating an instance, further dependencies might be discovered, which need to be resolved as well.

The request for an instance is represented as a CoreDepenencyKey, which can represent a request for both an instance of a type or an instance needed to by an injection point.

The CoreInjector contains a list of CreationRules which are applied until one of them succeeds. These core creation rules are typically configured by the creationPipeline of the standard module (look in StandardInjectorConfiguration. The default pipeline has the following steps:

  1. static bindings: try to match a binding configured explicitley in the modules
  2. creation rules: try the creation rules until the first one succeeds. Not to be confused with the creation rules of the core injector
  3. jit bindings: create a jit binding key and apply the jit binding rules

Clone this wiki locally