Search in sources :

Example 6 with GlobalChannelInterceptorWrapper

use of org.springframework.integration.channel.interceptor.GlobalChannelInterceptorWrapper in project spring-integration by spring-projects.

the class GlobalChannelInterceptorProcessor method afterSingletonsInstantiated.

@Override
public void afterSingletonsInstantiated() {
    Collection<GlobalChannelInterceptorWrapper> interceptors = this.beanFactory.getBeansOfType(GlobalChannelInterceptorWrapper.class).values();
    if (CollectionUtils.isEmpty(interceptors)) {
        logger.debug("No global channel interceptors.");
    } else {
        for (GlobalChannelInterceptorWrapper channelInterceptor : interceptors) {
            if (channelInterceptor.getOrder() >= 0) {
                this.positiveOrderInterceptors.add(channelInterceptor);
            } else {
                this.negativeOrderInterceptors.add(channelInterceptor);
            }
        }
        Map<String, ChannelInterceptorAware> channels = this.beanFactory.getBeansOfType(ChannelInterceptorAware.class);
        for (Entry<String, ChannelInterceptorAware> entry : channels.entrySet()) {
            addMatchingInterceptors(entry.getValue(), entry.getKey());
        }
    }
    // TODO Remove this logic in 5.1
    Properties integrationProperties = IntegrationContextUtils.getIntegrationProperties(this.beanFactory);
    this.singletonsInstantiated = Boolean.parseBoolean(integrationProperties.getProperty(IntegrationProperties.POST_PROCESS_DYNAMIC_BEANS));
}
Also used : GlobalChannelInterceptorWrapper(org.springframework.integration.channel.interceptor.GlobalChannelInterceptorWrapper) Properties(java.util.Properties) IntegrationProperties(org.springframework.integration.context.IntegrationProperties) ChannelInterceptorAware(org.springframework.integration.channel.ChannelInterceptorAware)

Aggregations

GlobalChannelInterceptorWrapper (org.springframework.integration.channel.interceptor.GlobalChannelInterceptorWrapper)6 ChannelInterceptorAware (org.springframework.integration.channel.ChannelInterceptorAware)5 ChannelInterceptor (org.springframework.messaging.support.ChannelInterceptor)5 HashMap (java.util.HashMap)4 Test (org.junit.Test)4 ArrayList (java.util.ArrayList)1 Properties (java.util.Properties)1 VetoCapableInterceptor (org.springframework.integration.channel.interceptor.VetoCapableInterceptor)1 IntegrationProperties (org.springframework.integration.context.IntegrationProperties)1