BeanNameAutoProxyCreator detects alias matches for specified bean names as well (SPR-6774)
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@2880 50f2f4bb-b051-0410-bef5-90022cba6387
This commit is contained in:
parent
a7b4dd195f
commit
6a41d6b2a0
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2008 the original author or authors.
|
||||
* Copyright 2002-2010 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.
|
||||
|
|
@ -84,6 +84,15 @@ public class BeanNameAutoProxyCreator extends AbstractAutoProxyCreator {
|
|||
if (isMatch(beanName, mappedName)) {
|
||||
return PROXY_WITHOUT_ADDITIONAL_INTERCEPTORS;
|
||||
}
|
||||
BeanFactory beanFactory = getBeanFactory();
|
||||
if (beanFactory != null) {
|
||||
String[] aliases = beanFactory.getAliases(beanName);
|
||||
for (String alias : aliases) {
|
||||
if (isMatch(alias, mappedName)) {
|
||||
return PROXY_WITHOUT_ADDITIONAL_INTERCEPTORS;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return DO_NOT_PROXY;
|
||||
|
|
|
|||
|
|
@ -92,11 +92,13 @@
|
|||
<property name="name"><value>jdk1</value></property>
|
||||
</bean>
|
||||
|
||||
<bean id="frozenBean" class="org.springframework.beans.TestBean">
|
||||
<bean id="frozen" class="org.springframework.beans.TestBean">
|
||||
<property name="name" value="frozenBean"/>
|
||||
</bean>
|
||||
|
||||
<bean id="cglib1" class="org.springframework.beans.TestBean">
|
||||
<alias name="frozen" alias="frozenBean"/>
|
||||
|
||||
<bean id="cglib1" class="org.springframework.beans.TestBean">
|
||||
<property name="name"><value>cglib1</value></property>
|
||||
</bean>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue