Class SourceFilteringListener

java.lang.Object
org.springframework.context.event.SourceFilteringListener
All Implemented Interfaces:
EventListener, ApplicationListener<ApplicationEvent>, GenericApplicationListener, SmartApplicationListener, org.springframework.core.Ordered

public class SourceFilteringListener extends Object implements GenericApplicationListener
ApplicationListener decorator that filters events from a specified event source, invoking its delegate listener for matching ApplicationEvent objects only.

Can also be used as base class, overriding the onApplicationEventInternal(ApplicationEvent) method instead of specifying a delegate listener.

Since:
2.0.5
Author:
Juergen Hoeller, Stephane Nicoll
  • Constructor Details

    • SourceFilteringListener

      public SourceFilteringListener(Object source, ApplicationListener<?> delegate)
      Create a SourceFilteringListener for the given event source.
      Parameters:
      source - the event source that this listener filters for, only processing events from this source
      delegate - the delegate listener to invoke with event from the specified source
    • SourceFilteringListener

      protected SourceFilteringListener(Object source)
      Create a SourceFilteringListener for the given event source, expecting subclasses to override the onApplicationEventInternal(ApplicationEvent) method (instead of specifying a delegate listener).
      Parameters:
      source - the event source that this listener filters for, only processing events from this source
  • Method Details