Source:
<code>public Object postProcessAfterInitialization(final Object bean, String beanName) throws BeansException { Class<?> targetClass = AopUtils.isAopProxy(bean) ? AopUtils.getTargetClass(bean) : bean.getClass(); ReflectionUtils.doWithMethods(targetClass, new ReflectionUtils.MethodCallback() { @Override public void doWith(final Method method) throws IllegalArgumentException, IllegalAccessException { StreamListener streamListener = AnnotationUtils.findAnnotation(method, StreamListener.class); if (streamListener != null) { Class<?>[] parameterTypes = method.getParameterTypes(); boolean hasInputOrOutputAnnotatedParameters = false; for (int parameterIndex = 0; parameterIndex < parameterTypes.length; parameterIndex++) { MethodParameter methodParameter = MethodParameter.forMethodOrConstructor(method, parameterIndex); boolean currentParameterIsAnnotated = methodParameter.getParameterAnnotation( Input.class) != null || methodParameter.getParameterAnnotation(Output.class) != null; <START> if (hasInputOrOutputAnnotatedParameters) { <END> Assert.isTrue(currentParameterIsAnnotated, "Either all parameters must be annotated with @Input and @Output, or none"); } else { hasInputOrOutputAnnotatedParameters = currentParameterIsAnnotated; } } if (!hasInputOrOutputAnnotatedParameters) { registerHandlerMethodOnListenedChannel(method, streamListener, bean); } else { invokeSetupMethodOnListenedChannel(method, bean); } } } }); return bean; }</code><technical_language>I this catch case 1st param is _not_ annotated if subsequent params are... instead iterate a counter end of loop assert count is 0 equal parameterTypes.length</technical_language>

Target:
public Object postProcessAfterInitialization(final Object bean, String beanName) throws BeansException { Class<?> targetClass = AopUtils.isAopProxy(bean) ? AopUtils.getTargetClass(bean) : bean.getClass(); ReflectionUtils.doWithMethods(targetClass, new ReflectionUtils.MethodCallback() { @Override public void doWith(final Method method) throws IllegalArgumentException, IllegalAccessException { StreamListener streamListener = AnnotationUtils.findAnnotation(method, StreamListener.class); if (streamListener != null) { if (!method.getReturnType().equals(Void.TYPE)) { Assert.isTrue(method.getAnnotation(Input.class) == null, "A @StreamListener may never be annotated with @Input." + "If it should listen to a specific input, use the value of @StreamListener " + "instead."); } Class<?>[] parameterTypes = method.getParameterTypes(); if (StringUtils.hasText(streamListener.value())) { for (int i = 0; i < parameterTypes.length; i++) { MethodParameter methodParameter = MethodParameter.forMethodOrConstructor(method, i); Assert.isTrue(methodParameter.getParameterAnnotation(Input.class) == null && methodParameter.getParameterAnnotation(Output.class) == null, "A message handling @StreamListener method cannot have parameters annotated " + "with @Input or @Output"); } if (!method.getReturnType().equals(Void.TYPE)) { Assert.isTrue(method.getAnnotation(Output.class) == null, "A message handling @StreamListener method cannot be annotated with @Output"); } registerHandlerMethodOnListenedChannel(method, streamListener, bean); } else { for (int i = 0; i < parameterTypes.length; i++) { MethodParameter methodParameter = MethodParameter.forMethodOrConstructor(method, i); Assert.isTrue(methodParameter.getParameterAnnotation(Input.class) != null ^ methodParameter.getParameterAnnotation(Output.class) != null, "A declarative @StreamListener method must have its parameters annotated" + "with @Input or @Output, but not with both."); } if (!method.getReturnType().equals(Void.TYPE)) { Assert.isTrue(method.getAnnotation(Output.class) != null, "A declarative @StreamListener method must be annotated with @Output"); } invokeSetupMethodOnListenedChannel(method, bean); } } } }); return bean; }