接口 ApplicationEventPublisher

    • 方法详细资料

      • 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 an ApplicationEvent, it is wrapped in a PayloadApplicationEvent.

        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