Annotation Interface Context


@Singleton @Documented @Retention(RUNTIME) public @interface Context

Context scope indicates that the classes life cycle is bound to that of the BeanContext and it should be initialized and shutdown during startup and shutdown of the underlying BeanContext.

Micronaut by default treats all Singleton bean definitions as lazy and will only load them on demand. By annotating a bean with @Context you can ensure that the bean is loaded at the same time as the context.

WARNING: This annotation should be used sparingly as Micronaut is designed in such a way as to encourage minimal bean creation during startup.

NOTE: This annotation can also be used as a meta annotation

See Also: