Example usage for org.springframework.context.event ApplicationEventMulticaster removeApplicationListenerBean

List of usage examples for org.springframework.context.event ApplicationEventMulticaster removeApplicationListenerBean

Introduction

In this page you can find the example usage for org.springframework.context.event ApplicationEventMulticaster removeApplicationListenerBean.

Prototype

void removeApplicationListenerBean(String listenerBeanName);

Source Link

Document

Remove a listener bean from the notification list.

Usage

From source file:org.springframework.context.support.ApplicationListenerDetector.java

@Override
public void postProcessBeforeDestruction(Object bean, String beanName) {
    if (bean instanceof ApplicationListener) {
        try {//  w  w w.j a  v  a  2s .c om
            ApplicationEventMulticaster multicaster = this.applicationContext.getApplicationEventMulticaster();
            multicaster.removeApplicationListener((ApplicationListener<?>) bean);
            multicaster.removeApplicationListenerBean(beanName);
        } catch (IllegalStateException ex) {
            // ApplicationEventMulticaster not initialized yet - no need to remove a listener
        }
    }
}