Source:
<code>public final void afterSingletonsInstantiated() { for (Map.Entry<String, List<StreamListenerHandlerMethodMapping>> mappedBindingEntry : mappedListenerMethods .entrySet()) { Collection<DispatchingStreamListenerMessageHandler.ConditionalStreamListenerHandler> handlerMethods = new ArrayList<>(); for (StreamListenerHandlerMethodMapping mapping : mappedBindingEntry.getValue()) { final InvocableHandlerMethod invocableHandlerMethod = this.messageHandlerMethodFactory .createInvocableHandlerMethod(mapping.getTargetBean(), checkProxy(mapping.getMethod(), mapping.getTargetBean())); StreamListenerMessageHandler streamListenerMessageHandler = new StreamListenerMessageHandler( invocableHandlerMethod); streamListenerMessageHandler.setApplicationContext(this.applicationContext); streamListenerMessageHandler.setBeanFactory(this.applicationContext.getBeanFactory()); if (StringUtils.hasText(mapping.getDefaultOutputChannel())) { streamListenerMessageHandler.setOutputChannelName(mapping.getDefaultOutputChannel()); } streamListenerMessageHandler.afterPropertiesSet(); if (StringUtils.hasText(mapping.getCondition())) { <START> Expression condition = new SpelExpressionParser().parseExpression(mapping.getCondition()); <END> handlerMethods.add(new DispatchingStreamListenerMessageHandler.ConditionalStreamListenerHandler( condition, streamListenerMessageHandler)); } else { handlerMethods.add(new DispatchingStreamListenerMessageHandler.ConditionalStreamListenerHandler( null, streamListenerMessageHandler)); } } DispatchingStreamListenerMessageHandler handler = new DispatchingStreamListenerMessageHandler( handlerMethods, this.evaluationContext); handler.setApplicationContext(this.applicationContext); handler.setChannelResolver(this.binderAwareChannelResolver); handler.afterPropertiesSet(); applicationContext.getBean(mappedBindingEntry.getKey(), SubscribableChannel.class).subscribe(handler); } this.mappedListenerMethods.clear(); }</code><technical_language>Nitpicking: create SpelExpressionParser for loop</technical_language>

Target:
public final void afterSingletonsInstantiated() { this.evaluationContext = IntegrationContextUtils.getEvaluationContext(this.applicationContext.getBeanFactory()); for (Map.Entry<String, List<StreamListenerHandlerMethodMapping>> mappedBindingEntry : mappedListenerMethods .entrySet()) { Collection<DispatchingStreamListenerMessageHandler.ConditionalStreamListenerHandler> handlers = new ArrayList<>(); for (StreamListenerHandlerMethodMapping mapping : mappedBindingEntry.getValue()) { final InvocableHandlerMethod invocableHandlerMethod = this.messageHandlerMethodFactory .createInvocableHandlerMethod(mapping.getTargetBean(), checkProxy(mapping.getMethod(), mapping.getTargetBean())); StreamListenerMessageHandler streamListenerMessageHandler = new StreamListenerMessageHandler( invocableHandlerMethod); streamListenerMessageHandler.setApplicationContext(this.applicationContext); streamListenerMessageHandler.setBeanFactory(this.applicationContext.getBeanFactory()); if (StringUtils.hasText(mapping.getDefaultOutputChannel())) { streamListenerMessageHandler.setOutputChannelName(mapping.getDefaultOutputChannel()); } streamListenerMessageHandler.afterPropertiesSet(); if (StringUtils.hasText(mapping.getCondition())) { String conditionAsString = resolveExpressionAsString(mapping.getCondition()); Expression condition = SPEL_EXPRESSION_PARSER.parseExpression(conditionAsString); handlers.add(new DispatchingStreamListenerMessageHandler.ConditionalStreamListenerHandler( condition, streamListenerMessageHandler)); } else { handlers.add(new DispatchingStreamListenerMessageHandler.ConditionalStreamListenerHandler( null, streamListenerMessageHandler)); } } if (handlers.size() > 1) { for (DispatchingStreamListenerMessageHandler.ConditionalStreamListenerHandler handler : handlers) { Assert.isTrue(handler.isVoid(), StreamListenerErrorMessages.MULTIPLE_VALUE_RETURNING_METHODS); } } DispatchingStreamListenerMessageHandler handler = new DispatchingStreamListenerMessageHandler( handlers, this.evaluationContext); handler.setApplicationContext(this.applicationContext); handler.setChannelResolver(this.binderAwareChannelResolver); handler.afterPropertiesSet(); applicationContext.getBean(mappedBindingEntry.getKey(), SubscribableChannel.class).subscribe(handler); } this.mappedListenerMethods.clear(); }