List of usage examples for org.springframework.context.event SmartApplicationListener SmartApplicationListener
SmartApplicationListener
From source file:com.codeabovelab.dm.gateway.proxy.common.BalancerConfiguration.java
/** * Listens ContextClosedEvent and Closes all async http connections *//*from ww w.j a v a 2s . co m*/ @Bean ApplicationListener<?> applicationListener() { return new SmartApplicationListener() { @Override public int getOrder() { return 0; } @Override public boolean supportsEventType(Class<? extends ApplicationEvent> eventType) { return ContextClosedEvent.class.isAssignableFrom(eventType); } @Override public boolean supportsSourceType(Class<?> sourceType) { return true; } @Override public void onApplicationEvent(ApplicationEvent event) { Closeables.close(proxyInstance); } }; }