接口 ApplicationListener<E extends ApplicationEvent>
- 类型参数:
E- the specific event to listen to
- 所有超级接口:
EventListener
- 所有已知实现类:
ApplicationListenerMethodAdapter,GenericApplicationListenerAdapter,ScheduledAnnotationBeanPostProcessor,SourceFilteringListener
- 函数接口:
- 这是一个函数接口, 因此可用作 lambda 表达式或方法引用的赋值目标。
@FunctionalInterface
public interface ApplicationListener<E extends ApplicationEvent>
extends EventListener
Interface to be implemented by application event listeners.
Based on the standard java.util.EventListener interface
for the Observer design pattern.
As of 4.0, an ApplicationListener can generically declare
the event type that it is interested in. When registered with a
ApplicationContext, events will be filtered accordingly, with the
listener getting invoked for matching event objects only.
- 作者:
- Rod Johnson, Juergen Hoeller, TODAY 2018-09-09 21:23
- 另请参阅:
-
方法概要
修饰符和类型方法说明static <T> ApplicationListener<PayloadApplicationEvent<T>>forPayload(Consumer<T> consumer) Create a newApplicationListenerfor the given payload consumer.voidonApplicationEvent(E event) Handle an application event.
-
方法详细资料
-
onApplicationEvent
Handle an application event.- 参数:
event- the event to respond to
-
forPayload
Create a newApplicationListenerfor the given payload consumer.- 类型参数:
T- the type of the event payload- 参数:
consumer- the event payload consumer- 返回:
- a corresponding
ApplicationListenerinstance - 从以下版本开始:
- 4.0
- 另请参阅:
-