klyn.di.DIContext.close
method

    public close() as Void throws Exception:

Description

Closes this context and destroys managed components in reverse creation order.

Methods annotated with `@DestroyMethod` are invoked once before their component registration is removed. Components registered directly with `registerComponent(...)` remain caller-owned and are not destroyed.

Throws

- Exception if a destruction callback fails. Remaining callbacks are still attempted before the first error is rethrown.

Example

    import klyn.di

    context = DIContext()
    context.createComponent(CacheService.type)
    context.close()