Module springtime_di::scope

source ·
Expand description

Component instances are contained in Scopes - containers which decide when to reuse or create an instance. There’s a global one for singletons, but there also can be other, specialized ones. Some can be simple, like PrototypeScope, while other can be quite complex and depend on external factors, e.g. tying the lifetime of instances to web sessions.

Note: scope resolution happens at component instantiation time, which can lead to unexpected consequences if incompatible scopes are mixed together, e.g. a singleton component can depend on a prototype one. In such case when creating the singleton, a new instance of the dependency will be created, since it’s a prototype, but then that single instance will live as long as the singleton lives.

Structs

Constants

Traits

  • A scope containing component instances. See module documentation for information on scopes.
  • Factory for custom Scopes.

Type Definitions