zoukankan      html  css  js  c++  java
  • ApplicationEventPublisher笔记

    ApplicationEventPublisher是ApplicationContext的父接口之一。这接口的作用是:Interface that encapsulates event publication functionality.

    功能就是发布事件,也就是把某个事件告诉的所有与这个事件相关的监听器。

    这个接口只有两个方法(这两个是重载方法)。所以把整个接口的代码都贴上来。

    /**
     * Interface that encapsulates event publication functionality.
     * Serves as super-interface for {@link ApplicationContext}.
     *
     * @author Juergen Hoeller
     * @author Stephane Nicoll
     * @since 1.1.1
     * @see ApplicationContext
     * @see ApplicationEventPublisherAware
     * @see org.springframework.context.ApplicationEvent
     * @see org.springframework.context.event.EventPublicationInterceptor
     */
    public interface ApplicationEventPublisher {
    
        /**
         * Notify all <strong>matching</strong> listeners registered with this
         * application of an application event. Events may be framework events
         * (such as RequestHandledEvent) or application-specific events.
         * @param event the event to publish
         * @see org.springframework.web.context.support.RequestHandledEvent
    */ void publishEvent(ApplicationEvent event); /** * Notify all <strong>matching</strong> listeners registered with this * application of an event. * <p>If the specified {@code event} is not an {@link ApplicationEvent}, * it is wrapped in a {@link PayloadApplicationEvent}. * @param event the event to publish * @since 4.2 * @see PayloadApplicationEvent */ void publishEvent(Object event); }

    这个方法会通知的所有与事件相匹配的监听器。这些监听可能是spring框架的监听器,也有可能是特定的监听器。

  • 相关阅读:
    一种想法
    识别link_text
    识别name
    识别id
    文件的读写
    条件和循环
    网站测试-功能测试小结
    拷贝
    #团队博客作业1-小组成员介绍
    软件测试基础-Homework1
  • 原文地址:https://www.cnblogs.com/GooPolaris/p/8180045.html
Copyright © 2011-2022 走看看