klyn.di.DIContext.destroyComponent
method
public destroyComponent(name as String) as Boolean throws Exception:
Description

Destroys and unregisters one component.

Managed components created through createComponent(...) receive their @DestroyMethod callbacks before removal. Directly registered components are simply unregistered because their lifecycle remains caller-owned.

Parameters
ParameterDescription
nameRegistered component name.
Returns

true when a component was removed, otherwise false.

Throws
  • Exception if a managed destruction callback fails. The component is still removed from the context.
Example
import klyn.di

context = DIContext()
context.createComponent(CacheService.type, "cache")
assert context.destroyComponent("cache")