From 90c9d96a4d432a31c6cfbb0c2e8f2ab83daeffef Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Fri, 13 Nov 2015 08:23:15 +0100 Subject: [PATCH] Avoid exposeTargetClass attempt if bean name is null Issue: SPR-13650 --- .../aop/framework/autoproxy/AutoProxyUtils.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spring-aop/src/main/java/org/springframework/aop/framework/autoproxy/AutoProxyUtils.java b/spring-aop/src/main/java/org/springframework/aop/framework/autoproxy/AutoProxyUtils.java index 293d9e437b..a771146f38 100644 --- a/spring-aop/src/main/java/org/springframework/aop/framework/autoproxy/AutoProxyUtils.java +++ b/spring-aop/src/main/java/org/springframework/aop/framework/autoproxy/AutoProxyUtils.java @@ -94,14 +94,14 @@ public abstract class AutoProxyUtils { } /** - * Expose the given target class for the specified bean. + * Expose the given target class for the specified bean, if possible. * @param beanFactory the containing ConfigurableListableBeanFactory * @param beanName the name of the bean * @param targetClass the corresponding target class * @since 4.2.3 */ static void exposeTargetClass(ConfigurableListableBeanFactory beanFactory, String beanName, Class targetClass) { - if (beanFactory.containsBeanDefinition(beanName)) { + if (beanName != null && beanFactory.containsBeanDefinition(beanName)) { beanFactory.getMergedBeanDefinition(beanName).setAttribute(ORIGINAL_TARGET_CLASS_ATTRIBUTE, targetClass); } }