From 65a167f7fd902b587fba49116203bd8836920a15 Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Tue, 16 Jan 2018 14:39:31 +0100 Subject: [PATCH] JmsListenerAnnotationBeanPostProcessor properly deals with nested proxies Issue: SPR-16196 --- .../annotation/JmsListenerAnnotationBeanPostProcessor.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/spring-jms/src/main/java/org/springframework/jms/annotation/JmsListenerAnnotationBeanPostProcessor.java b/spring-jms/src/main/java/org/springframework/jms/annotation/JmsListenerAnnotationBeanPostProcessor.java index cac9b4d18e..533799bb77 100644 --- a/spring-jms/src/main/java/org/springframework/jms/annotation/JmsListenerAnnotationBeanPostProcessor.java +++ b/spring-jms/src/main/java/org/springframework/jms/annotation/JmsListenerAnnotationBeanPostProcessor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2017 the original author or authors. + * Copyright 2002-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,6 +28,7 @@ import java.util.concurrent.atomic.AtomicInteger; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.springframework.aop.framework.AopProxyUtils; import org.springframework.aop.support.AopUtils; import org.springframework.beans.BeansException; import org.springframework.beans.factory.BeanFactory; @@ -219,7 +220,7 @@ public class JmsListenerAnnotationBeanPostProcessor @Override public Object postProcessAfterInitialization(final Object bean, String beanName) throws BeansException { if (!this.nonAnnotatedClasses.contains(bean.getClass())) { - Class targetClass = AopUtils.getTargetClass(bean); + Class targetClass = AopProxyUtils.ultimateTargetClass(bean); Map> annotatedMethods = MethodIntrospector.selectMethods(targetClass, (MethodIntrospector.MetadataLookup>) method -> { Set listenerMethods = AnnotatedElementUtils.getMergedRepeatableAnnotations(