Annotation Interface ApplicationScoped


@Target({TYPE,METHOD,FIELD}) @Retention(RUNTIME) @Documented @NormalScope @Inherited public @interface ApplicationScoped

Specifies that a bean is application scoped.

The application scope is global. Extensions are not allowed to register a custom context for it.

An event with qualifier @Initialized(ApplicationScoped.class) is fired immediately after the application context is initialized. An event with qualifier @BeforeDestroyed(ApplicationScoped.class) is fired immediately before the application context is destroyed. An event with qualifier @Destroyed(ApplicationScoped.class) is fired immediately after the application context is destroyed. In all cases, the event payload is:

  • the ServletContext if the application is a web application deployed to a Servlet container, or
  • any java.lang.Object for other types of application.
Author:
Gavin King, Pete Muir, Antoine Sabot-Durand