• 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框架的监听器,也有可能是特定的监听器。

  • 相关阅读:
    tmux 简明操作指南
    几种查看linux版本信息的方法
    安装Ruby&Rails遇到的问题
    安装DevKit
    gcc 编译选项
    EF数据操作详解
    值类型和引用类型的区别
    Class<T> where T:new() 含义
    50道高级sql练习题;大大提高自己的sql能力(附具体的sql)
    Entity framework 意外删除了表,如何在不影响其它表的情况下恢复回来
  • 原文地址:https://www.cnblogs.com/GooPolaris/p/8180045.html
Copyright © 2020-2023  润新知