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

  • 相关阅读:
    mybatis 枚举的支持
    windows系统下Disconf web安装-分布式配置管理平台
    Tomcat启动报Error listenerStart错误
    Java并发编程:volatile关键字解析
    深入理解java异常处理机制
    Java 常见异常种类
    Java RMI与RPC的区别
    Java的快速失败和安全失败
    mysql数据类型介绍(含text,longtext,mediumtext说明)
    DTO – 服务实现中的核心数据
  • 原文地址:https://www.cnblogs.com/GooPolaris/p/8180045.html
Copyright © 2011-2022 走看看