@@ -427,27 +427,7 @@ private Method checkProxy(Method methodArg, Object bean) {
427427 protected void processListener (MethodRabbitListenerEndpoint endpoint , RabbitListener rabbitListenerArg , Object bean ,
428428 Object target , String beanName ) {
429429
430- RabbitListener rabbitListener = rabbitListenerArg ;
431- MergedAnnotation <RabbitListener > mergedAnnotation = MergedAnnotation .missing ();
432- /*
433- * Synthesize the actual annotation to handle meta-annotations and aliasing. Note
434- * that only single @RabbitListener annotations can be meta-annotated.
435- */
436- if (endpoint instanceof MultiMethodRabbitListenerEndpoint ) {
437- if (AnnotationUtils .findAnnotation ((Class <?>) target , RabbitListeners .class ) == null ) {
438- mergedAnnotation = MergedAnnotations .from ((Class <?>) target , SearchStrategy .TYPE_HIERARCHY )
439- .get (RabbitListener .class );
440- }
441- }
442- else {
443- if (AnnotationUtils .findAnnotation (endpoint .getMethod (), RabbitListeners .class ) == null ) {
444- mergedAnnotation = MergedAnnotations .from (endpoint .getMethod (), SearchStrategy .TYPE_HIERARCHY )
445- .get (RabbitListener .class );
446- }
447- }
448- if (!MergedAnnotation .missing ().equals (mergedAnnotation )) {
449- rabbitListener = mergedAnnotation .synthesize ();
450- }
430+ RabbitListener rabbitListener = synthesizeIfPossible (endpoint , rabbitListenerArg , target );
451431 endpoint .setBean (bean );
452432 endpoint .setMessageHandlerMethodFactory (this .messageHandlerMethodFactory );
453433 endpoint .setId (getEndpointId (rabbitListener ));
@@ -501,6 +481,33 @@ else if (errorHandler instanceof String) {
501481 this .registrar .registerEndpoint (endpoint , factory );
502482 }
503483
484+ private RabbitListener synthesizeIfPossible (MethodRabbitListenerEndpoint endpoint , RabbitListener rabbitListenerArg ,
485+ Object target ) {
486+
487+ RabbitListener rabbitListener = rabbitListenerArg ;
488+ MergedAnnotation <RabbitListener > mergedAnnotation = MergedAnnotation .missing ();
489+ /*
490+ * Synthesize the actual annotation to handle meta-annotations and aliasing. Note
491+ * that only single @RabbitListener annotations can be meta-annotated.
492+ */
493+ if (endpoint instanceof MultiMethodRabbitListenerEndpoint ) {
494+ if (AnnotationUtils .findAnnotation ((Class <?>) target , RabbitListeners .class ) == null ) {
495+ mergedAnnotation = MergedAnnotations .from ((Class <?>) target , SearchStrategy .TYPE_HIERARCHY )
496+ .get (RabbitListener .class );
497+ }
498+ }
499+ else {
500+ if (AnnotationUtils .findAnnotation (endpoint .getMethod (), RabbitListeners .class ) == null ) {
501+ mergedAnnotation = MergedAnnotations .from (endpoint .getMethod (), SearchStrategy .TYPE_HIERARCHY )
502+ .get (RabbitListener .class );
503+ }
504+ }
505+ if (!MergedAnnotation .missing ().equals (mergedAnnotation )) {
506+ rabbitListener = mergedAnnotation .synthesize ();
507+ }
508+ return rabbitListener ;
509+ }
510+
504511 private void resolveAckMode (MethodRabbitListenerEndpoint endpoint , RabbitListener rabbitListener ) {
505512 String ackModeAttr = rabbitListener .ackMode ();
506513 if (StringUtils .hasText (ackModeAttr )) {
0 commit comments