Package io.quarkus.runtime
Annotation Type Startup
-
@Target({TYPE,METHOD,FIELD}) @Retention(RUNTIME) public @interface Startup
This annotation can be used to initialize a CDI bean at application startup. The behavior is similar to a declaration of an observer of theStartupEvent
- a contextual instance is created and lifecycle callbacks (such asPostConstruct
) are invoked. In fact, a synthetic observer of theStartupEvent
is generated for each bean annotated with this annotation. Furthermore,value()
can be used to specify the priority of the generated observer method and thus affect observers ordering.The contextual instance is destroyed immediately afterwards for
Dependent
beans.The following examples are functionally equivalent.
@ApplicationScoped class Bean1 { void onStart(@Observes StartupEvent event) { // place the logic here } } @Startup @ApplicationScoped class Bean2 { }
- See Also:
StartupEvent
-
-
Optional Element Summary
Optional Elements Modifier and Type Optional Element Description int
value
-