diff --git a/org.springframework.aop/src/main/java/org/springframework/aop/framework/autoproxy/BeanNameAutoProxyCreator.java b/org.springframework.aop/src/main/java/org/springframework/aop/framework/autoproxy/BeanNameAutoProxyCreator.java index cec7f9907b..a7b01b573c 100644 --- a/org.springframework.aop/src/main/java/org/springframework/aop/framework/autoproxy/BeanNameAutoProxyCreator.java +++ b/org.springframework.aop/src/main/java/org/springframework/aop/framework/autoproxy/BeanNameAutoProxyCreator.java @@ -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; diff --git a/org.springframework.context/src/test/java/org/springframework/aop/framework/autoproxy/BeanNameAutoProxyCreatorTests-context.xml b/org.springframework.context/src/test/java/org/springframework/aop/framework/autoproxy/BeanNameAutoProxyCreatorTests-context.xml index 853dddc86d..0f4b265b72 100644 --- a/org.springframework.context/src/test/java/org/springframework/aop/framework/autoproxy/BeanNameAutoProxyCreatorTests-context.xml +++ b/org.springframework.context/src/test/java/org/springframework/aop/framework/autoproxy/BeanNameAutoProxyCreatorTests-context.xml @@ -92,11 +92,13 @@ jdk1 - + - + + + cglib1