DIContext
class in package klyn.di

    public class DIContext:

DIContext

Minimal dependency injection context.

This context stores named components and provides simple lookup APIs.

    import klyn.di

    context = DIContext()
    service = Object()
    context.registerComponent("service", service)
    assert context.getComponent("service") == service

Constructors

Modifier and Type | Member | Description
--- | --- | ---
public | DIContext `DIContext():` | Creates an empty dependency injection context.

Methods

Modifier and Type | Member | Description
--- | --- | ---
public | close `close() as Void throws Exception:` | Closes this context and destroys managed components in reverse creation order.
public | createComponent `createComponent(typeInfo as Type, name as String = "") as Object throws Exception:` | Creates and manages a component from reflected type metadata.
public | destroyComponent `destroyComponent(name as String) as Boolean throws Exception:` | Destroys and unregisters one component.
public | getComponent `getComponent(name as String) as Object:` | Returns a registered component by name.
public | registerComponent `registerComponent(name as String, component as Object) as Void:` | Registers a component instance under a name.
public | scanAnnotations `scanAnnotations() as Void:` | Scans annotations and registers discovered singleton components.