Source:
public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException { if (bean instanceof Advised) { for (Advisor advisor : ((Advised) bean).getAdvisors()) { Advice advice = advisor.getAdvice(); if (advice instanceof MessageHandlerMetrics || advice instanceof MessageSourceMetrics || advice instanceof MessageChannelMetrics) { return bean; } } } if (IntegrationContextUtils.INTEGRATION_MESSAGE_HISTORY_CONFIGURER_BEAN_NAME.equals(beanName) && bean instanceof MessageHistoryConfigurer) { this.messageHistoryConfigurer = (MessageHistoryConfigurer) bean; return bean; } if (bean instanceof MessageHandler) { if (this.handlerInAnonymousWrapper(bean) != null) { if (logger.isDebugEnabled()) { logger.debug("Skipping " + beanName + " because it wraps another handler"); } return bean; } SimpleMessageHandlerMetrics monitor = new SimpleMessageHandlerMetrics((MessageHandler) bean); Object advised = applyHandlerInterceptor(bean, monitor, beanClassLoader); handlers.add(monitor); bean = advised; } if (bean instanceof MessageSource<?>) { SimpleMessageSourceMetrics monitor = new SimpleMessageSourceMetrics((MessageSource<?>) bean); Object advised = applySourceInterceptor(bean, monitor, beanClassLoader); sources.add(monitor); bean = advised; } if (bean instanceof MessageChannel) { DirectChannelMetrics monitor; MessageChannel target = (MessageChannel) extractTarget(bean); if (bean instanceof PollableChannel) { if (target instanceof QueueChannel) { monitor = new QueueChannelMetrics((QueueChannel) target, beanName); } else { monitor = new PollableChannelMetrics(target, beanName); } } else { monitor = new DirectChannelMetrics(target, beanName); } Object advised = applyChannelInterceptor(bean, monitor, beanClassLoader); channels.add(monitor); bean = advised; } if (bean instanceof MessageProducer && bean instanceof Lifecycle) { Lifecycle target = (Lifecycle) extractTarget(bean); if (!(target instanceof AbstractReplyProducingMessageHandler)) { this.inboundLifecyleMessageProducers.add(target); } } return bean; }

Target:
public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException { if (bean instanceof Advised) { for (Advisor advisor : ((Advised) bean).getAdvisors()) { Advice advice = advisor.getAdvice(); if (advice instanceof MessageHandlerMetrics || advice instanceof MessageSourceMetrics || advice instanceof MessageChannelMetrics) { return bean; } } } if (IntegrationContextUtils.INTEGRATION_MESSAGE_HISTORY_CONFIGURER_BEAN_NAME.equals(beanName) && bean instanceof MessageHistoryConfigurer) { this.messageHistoryConfigurer = (MessageHistoryConfigurer) bean; return bean; } if (bean instanceof MessageHandler) { if (this.handlerInAnonymousWrapper(bean) != null) { if (logger.isDebugEnabled()) { logger.debug("Skipping " + beanName + " because it wraps another handler"); } return bean; } SimpleMessageHandlerMetrics monitor = new SimpleMessageHandlerMetrics((MessageHandler) bean); Object advised = applyHandlerInterceptor(bean, monitor, beanClassLoader); handlers.add(monitor); bean = advised; } if (bean instanceof MessageSource<?>) { SimpleMessageSourceMetrics monitor = new SimpleMessageSourceMetrics((MessageSource<?>) bean); Object advised = applySourceInterceptor(bean, monitor, beanClassLoader); sources.add(monitor); bean = advised; } if (bean instanceof MessageChannel) { DirectChannelMetrics monitor; MessageChannel target = (MessageChannel) extractTarget(bean); if (bean instanceof PollableChannel) { if (target instanceof QueueChannel) { monitor = new QueueChannelMetrics((QueueChannel) target, beanName); } else { monitor = new PollableChannelMetrics(target, beanName); } } else { monitor = new DirectChannelMetrics(target, beanName); } Object advised = applyChannelInterceptor(bean, monitor, beanClassLoader); channels.add(monitor); bean = advised; } if (bean instanceof MessageProducer && bean instanceof Lifecycle) { Lifecycle target = (Lifecycle) extractTarget(bean); if (!(target instanceof AbstractReplyProducingMessageHandler)) { this.inboundLifecycleMessageProducers.add(target); } } return bean; }