接口 ApplicationEventPublisher
- 所有已知子接口:
ApplicationContext
,ConfigurableApplicationContext
,ConfigurableWebApplicationContext
,WebApplicationContext
- 所有已知实现类:
AbstractApplicationContext
,AbstractRefreshableApplicationContext
,AbstractRefreshableConfigApplicationContext
,AbstractRefreshableWebApplicationContext
,AbstractXmlApplicationContext
,AnnotationConfigApplicationContext
,AnnotationConfigWebApplicationContext
,ClassPathXmlApplicationContext
,FileSystemXmlApplicationContext
,GenericApplicationContext
,GenericGroovyApplicationContext
,GenericWebApplicationContext
,GenericXmlApplicationContext
,GroovyWebApplicationContext
,ResourceAdapterApplicationContext
,StaticApplicationContext
,StaticWebApplicationContext
,XmlWebApplicationContext
- 函数接口:
- 这是一个函数接口, 因此可用作 lambda 表达式或方法引用的赋值目标。
@FunctionalInterface public interface ApplicationEventPublisher
Interface that encapsulates event publication functionality.Serves as a super-interface for
ApplicationContext
.- 从以下版本开始:
- 1.1.1
- 作者:
- Juergen Hoeller, Stephane Nicoll
- 另请参阅:
ApplicationContext
,ApplicationEventPublisherAware
,ApplicationEvent
,ApplicationEventMulticaster
,EventPublicationInterceptor
方法概要
所有方法 实例方法 抽象方法 默认方法 修饰符和类型 方法 说明 void
publishEvent(Object event)
Notify all matching listeners registered with this application of an event.default void
publishEvent(ApplicationEvent event)
Notify all matching listeners registered with this application of an application event.
方法详细资料
publishEvent
default void publishEvent(ApplicationEvent event)
Notify all matching listeners registered with this application of an application event. Events may be framework events (such as ContextRefreshedEvent) or application-specific events.Such an event publication step is effectively a hand-off to the multicaster and does not imply synchronous/asynchronous execution or even immediate execution at all. Event listeners are encouraged to be as efficient as possible, individually using asynchronous execution for longer-running and potentially blocking operations.
- 参数:
event
- the event to publish- 另请参阅:
publishEvent(Object)
,ContextRefreshedEvent
,ContextClosedEvent
publishEvent
void publishEvent(Object event)
Notify all matching listeners registered with this application of an event.If the specified
event
is not anApplicationEvent
, it is wrapped in aPayloadApplicationEvent
.Such an event publication step is effectively a hand-off to the multicaster and does not imply synchronous/asynchronous execution or even immediate execution at all. Event listeners are encouraged to be as efficient as possible, individually using asynchronous execution for longer-running and potentially blocking operations.
- 参数:
event
- the event to publish- 从以下版本开始:
- 4.2
- 另请参阅:
publishEvent(ApplicationEvent)
,PayloadApplicationEvent