类 DeferredApplicationEventPublisher

  • 所有已实现的接口:
    java.util.EventListener, org.springframework.context.ApplicationEventPublisher, org.springframework.context.ApplicationListener<org.springframework.context.event.ContextRefreshedEvent>

    public class DeferredApplicationEventPublisher
    extends java.lang.Object
    implements org.springframework.context.ApplicationEventPublisher, org.springframework.context.ApplicationListener<org.springframework.context.event.ContextRefreshedEvent>
    Before Spring Framework 4.2, AbstractApplicationContext is an implementation of ApplicationEventPublisher can't handle the early event that is published before ApplicationEventMulticaster's initialization, in this scenario, DeferredApplicationEventPublisher is introduced and used to resolve publishEvent(ApplicationEvent) too early to publish ApplicationEvent when Spring ApplicationContexts' ApplicationEventMulticaster is not ready. First, DeferredApplicationEventPublisher stores these early events temporarily, and then re-publish them on Application context is ready.

    In contrast, If current runtime is based on Spring Framework that supports early application events, DeferredApplicationEventPublisher only delegates the Application Context that was injected by constructor.

    从以下版本开始:
    1.0.0
    作者:
    Mercy
    • 方法概要

      所有方法 实例方法 具体方法 
      修饰符和类型 方法 说明
      void onApplicationEvent​(org.springframework.context.event.ContextRefreshedEvent event)  
      void publishEvent​(java.lang.Object event)
      Current method will not be invoked before Spring 4.2
      void publishEvent​(org.springframework.context.ApplicationEvent event)  
      protected boolean supportsPublishEventMethod()  
      • 从类继承的方法 java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 构造器详细资料

      • DeferredApplicationEventPublisher

        public DeferredApplicationEventPublisher​(org.springframework.context.ApplicationEventPublisher delegate)
        参数:
        delegate - ApplicationEventPublisher
    • 方法详细资料

      • supportsPublishEventMethod

        protected boolean supportsPublishEventMethod()
      • publishEvent

        public void publishEvent​(org.springframework.context.ApplicationEvent event)
        指定者:
        publishEvent 在接口中 org.springframework.context.ApplicationEventPublisher
      • publishEvent

        public void publishEvent​(java.lang.Object event)
        Current method will not be invoked before Spring 4.2
        指定者:
        publishEvent 在接口中 org.springframework.context.ApplicationEventPublisher
        参数:
        event - the ApplicationEvent or the payload of event
      • onApplicationEvent

        public void onApplicationEvent​(org.springframework.context.event.ContextRefreshedEvent event)
        指定者:
        onApplicationEvent 在接口中 org.springframework.context.ApplicationListener<org.springframework.context.event.ContextRefreshedEvent>