Class DeferredApplicationEventPublisher

  • All Implemented Interfaces:
    java.util.EventListener, org.springframework.context.ApplicationEventPublisher, org.springframework.context.ApplicationListener<org.springframework.context.event.ContextRefreshedEvent>

    @Deprecated
    public class DeferredApplicationEventPublisher
    extends java.lang.Object
    implements org.springframework.context.ApplicationEventPublisher, org.springframework.context.ApplicationListener<org.springframework.context.event.ContextRefreshedEvent>
    Deprecated.
    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.

    Since:
    1.0.0
    Author:
    Mercy
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
        DeferredApplicationEventPublisher​(org.springframework.context.ApplicationEventPublisher delegate)
      Deprecated.
       
      protected DeferredApplicationEventPublisher​(org.springframework.context.ApplicationEventPublisher delegate, boolean shouldDefer)
      Deprecated.
       
    • Method Summary

      All Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      void onApplicationEvent​(org.springframework.context.event.ContextRefreshedEvent event)
      Deprecated.
       
      void publishEvent​(java.lang.Object event)
      Deprecated.
      Current method will not be invoked before Spring 4.2
      void publishEvent​(org.springframework.context.ApplicationEvent event)
      Deprecated.
       
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • DeferredApplicationEventPublisher

        public DeferredApplicationEventPublisher​(org.springframework.context.ApplicationEventPublisher delegate)
        Deprecated.
        Parameters:
        delegate - ApplicationEventPublisher
      • DeferredApplicationEventPublisher

        protected DeferredApplicationEventPublisher​(org.springframework.context.ApplicationEventPublisher delegate,
                                                    boolean shouldDefer)
        Deprecated.
    • Method Detail

      • publishEvent

        public void publishEvent​(org.springframework.context.ApplicationEvent event)
        Deprecated.
        Specified by:
        publishEvent in interface org.springframework.context.ApplicationEventPublisher
      • publishEvent

        public void publishEvent​(java.lang.Object event)
        Deprecated.
        Current method will not be invoked before Spring 4.2
        Specified by:
        publishEvent in interface org.springframework.context.ApplicationEventPublisher
        Parameters:
        event - the ApplicationEvent or the payload of event
      • onApplicationEvent

        public void onApplicationEvent​(org.springframework.context.event.ContextRefreshedEvent event)
        Deprecated.
        Specified by:
        onApplicationEvent in interface org.springframework.context.ApplicationListener<org.springframework.context.event.ContextRefreshedEvent>