## 类的使用
org.springframework.context.ApplicationEvent

- 使用ApplicationEvent的程序包
  程序包 | 说明
  --- | ---
  org.springframework.context | This package builds on the beans package to add support for message sources and for the Observer design pattern, and the ability for application objects to obtain resources using a consistent API.
  org.springframework.context.event | Support classes for application events, like standard context events.
  org.springframework.context.support | Classes supporting the org.springframework.context package, such as abstract base classes for ApplicationContext implementations and a MessageSource implementation.

- - ### org.springframework.context中ApplicationEvent的使用

    类型参数类型为ApplicationEvent的org.springframework.context中的类
    限定符和类型 | 接口和说明
    --- | ---
    `interface` | `ApplicationListener<E extends ApplicationEvent>` Interface to be implemented by application event listeners.

    org.springframework.context中ApplicationEvent的子类
    限定符和类型 | 类和说明
    --- | ---
    `class` | `PayloadApplicationEvent<T>` An `ApplicationEvent` that carries an arbitrary payload.

    参数类型为ApplicationEvent的org.springframework.context中的方法
    限定符和类型 | 方法和说明
    --- | ---
    `default void` | ApplicationEventPublisher.`publishEvent(ApplicationEvent event)` Notify all matching listeners registered with this application of an application event.

  - ### org.springframework.context.event中ApplicationEvent的使用

    org.springframework.context.event中ApplicationEvent的子类
    限定符和类型 | 类和说明
    --- | ---
    `class` | `ApplicationContextEvent` Base class for events raised for an `ApplicationContext`.
    `class` | `ContextClosedEvent` Event raised when an `ApplicationContext` gets closed.
    `class` | `ContextRefreshedEvent` Event raised when an `ApplicationContext` gets initialized or refreshed.
    `class` | `ContextStartedEvent` Event raised when an `ApplicationContext` gets started.
    `class` | `ContextStoppedEvent` Event raised when an `ApplicationContext` gets stopped.

    参数类型为ApplicationEvent的org.springframework.context.event中的方法
    限定符和类型 | 方法和说明
    --- | ---
    `protected Collection<ApplicationListener<?>>` | AbstractApplicationEventMulticaster.`getApplicationListeners(ApplicationEvent event, org.springframework.core.ResolvableType eventType)` Return a Collection of ApplicationListeners matching the given event type.
    `protected void` | SimpleApplicationEventMulticaster.`invokeListener(ApplicationListener<?> listener, ApplicationEvent event)` Invoke the given listener with the given event.
    `void` | ApplicationEventMulticaster.`multicastEvent(ApplicationEvent event)` Multicast the given application event to appropriate listeners.
    `void` | SimpleApplicationEventMulticaster.`multicastEvent(ApplicationEvent event)`
    `void` | ApplicationEventMulticaster.`multicastEvent(ApplicationEvent event, org.springframework.core.ResolvableType eventType)` Multicast the given application event to appropriate listeners.
    `void` | SimpleApplicationEventMulticaster.`multicastEvent(ApplicationEvent event, org.springframework.core.ResolvableType eventType)`
    `void` | ApplicationListenerMethodAdapter.`onApplicationEvent(ApplicationEvent event)`
    `void` | GenericApplicationListenerAdapter.`onApplicationEvent(ApplicationEvent event)`
    `void` | SourceFilteringListener.`onApplicationEvent(ApplicationEvent event)`
    `protected void` | SourceFilteringListener.`onApplicationEventInternal(ApplicationEvent event)` Actually process the event, after having filtered according to the desired event source already.
    `void` | ApplicationListenerMethodAdapter.`processEvent(ApplicationEvent event)` Process the specified `ApplicationEvent`, checking if the condition match and handling non-null result, if any.
    `protected Object[]` | ApplicationListenerMethodAdapter.`resolveArguments(ApplicationEvent event)` Resolve the method arguments to use for the specified `ApplicationEvent`.

    类型变量类型为ApplicationEvent的org.springframework.context.event中的方法参数
    限定符和类型 | 方法和说明
    --- | ---
    `boolean` | GenericApplicationListenerAdapter.`supportsEventType(Class<? extends ApplicationEvent> eventType)`
    `boolean` | SmartApplicationListener.`supportsEventType(Class<? extends ApplicationEvent> eventType)` Determine whether this listener actually supports the given event type.
    `boolean` | SourceFilteringListener.`supportsEventType(Class<? extends ApplicationEvent> eventType)`

  - ### org.springframework.context.support中ApplicationEvent的使用

    参数类型为ApplicationEvent的org.springframework.context.support中的方法
    限定符和类型 | 方法和说明
    --- | ---
    `void` | AbstractApplicationContext.`publishEvent(ApplicationEvent event)` Publish the given event to all listeners.