List of usage examples for org.springframework.context.event ApplicationEventMulticaster removeApplicationListener
void removeApplicationListener(ApplicationListener<?> listener);
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 av a 2 s .c o m*/ 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 } } }