Skip to content

Commit 90c9d96

Browse files
committed
Avoid exposeTargetClass attempt if bean name is null
Issue: SPR-13650
1 parent 2defb65 commit 90c9d96

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

spring-aop/src/main/java/org/springframework/aop/framework/autoproxy/AutoProxyUtils.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,14 +94,14 @@ public static Class<?> determineTargetClass(ConfigurableListableBeanFactory bean
9494
}
9595

9696
/**
97-
* Expose the given target class for the specified bean.
97+
* Expose the given target class for the specified bean, if possible.
9898
* @param beanFactory the containing ConfigurableListableBeanFactory
9999
* @param beanName the name of the bean
100100
* @param targetClass the corresponding target class
101101
* @since 4.2.3
102102
*/
103103
static void exposeTargetClass(ConfigurableListableBeanFactory beanFactory, String beanName, Class<?> targetClass) {
104-
if (beanFactory.containsBeanDefinition(beanName)) {
104+
if (beanName != null && beanFactory.containsBeanDefinition(beanName)) {
105105
beanFactory.getMergedBeanDefinition(beanName).setAttribute(ORIGINAL_TARGET_CLASS_ATTRIBUTE, targetClass);
106106
}
107107
}

0 commit comments

Comments
 (0)