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 | 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 components.