fixed isProxyFactoryBeanDefinition check (SPR-6842)
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@2981 50f2f4bb-b051-0410-bef5-90022cba6387
This commit is contained in:
parent
c8103fc175
commit
d0269c0756
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2006 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.
|
||||
|
|
@ -34,22 +34,25 @@ import org.springframework.util.ClassUtils;
|
|||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
* Base implementation for {@link org.springframework.beans.factory.xml.BeanDefinitionDecorator BeanDefinitionDecorators} wishing
|
||||
* to add an {@link org.aopalliance.intercept.MethodInterceptor interceptor} to the resulting
|
||||
* bean.
|
||||
* Base implementation for
|
||||
* {@link org.springframework.beans.factory.xml.BeanDefinitionDecorator BeanDefinitionDecorators}
|
||||
* wishing to add an {@link org.aopalliance.intercept.MethodInterceptor interceptor}
|
||||
* to the resulting bean.
|
||||
*
|
||||
* <p>This base class controls the creation of the {@link ProxyFactoryBean} bean definition
|
||||
* and wraps the original as an inner-bean definition for the <code>target</code> property of
|
||||
* {@link ProxyFactoryBean}.
|
||||
* and wraps the original as an inner-bean definition for the <code>target</code> property
|
||||
* of {@link ProxyFactoryBean}.
|
||||
*
|
||||
* <p>Chaining is correctly handled, ensuring that only one {@link ProxyFactoryBean} definition
|
||||
* is created. If a previous {@link org.springframework.beans.factory.xml.BeanDefinitionDecorator} already created the {@link org.springframework.aop.framework.ProxyFactoryBean}
|
||||
* then the interceptor is simply added to the existing definition.
|
||||
* is created. If a previous {@link org.springframework.beans.factory.xml.BeanDefinitionDecorator}
|
||||
* already created the {@link org.springframework.aop.framework.ProxyFactoryBean} then the
|
||||
* interceptor is simply added to the existing definition.
|
||||
*
|
||||
* <p>Subclasses have only to create the <code>BeanDefinition</code> to the interceptor they
|
||||
* wish to add.
|
||||
* <p>Subclasses have only to create the <code>BeanDefinition</code> to the interceptor that
|
||||
* they wish to add.
|
||||
*
|
||||
* @author Rob Harrop
|
||||
* @author Juergen Hoeller
|
||||
* @since 2.0
|
||||
* @see org.aopalliance.intercept.MethodInterceptor
|
||||
*/
|
||||
|
|
@ -72,7 +75,6 @@ public abstract class AbstractInterceptorDrivenBeanDefinitionDecorator implement
|
|||
BeanDefinitionHolder result = definitionHolder;
|
||||
|
||||
if (!isProxyFactoryBeanDefinition(existingDefinition)) {
|
||||
|
||||
// create the proxy definitionHolder
|
||||
RootBeanDefinition proxyDefinition = new RootBeanDefinition();
|
||||
// create proxy factory bean definitionHolder
|
||||
|
|
@ -93,18 +95,17 @@ public abstract class AbstractInterceptorDrivenBeanDefinitionDecorator implement
|
|||
}
|
||||
|
||||
addInterceptorNameToList(interceptorName, result.getBeanDefinition());
|
||||
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private void addInterceptorNameToList(String interceptorName, BeanDefinition beanDefinition) {
|
||||
List list = (List) beanDefinition.getPropertyValues().getPropertyValue("interceptorNames").getValue();
|
||||
List<String> list = (List<String>) beanDefinition.getPropertyValues().getPropertyValue("interceptorNames").getValue();
|
||||
list.add(interceptorName);
|
||||
}
|
||||
|
||||
private boolean isProxyFactoryBeanDefinition(BeanDefinition existingDefinition) {
|
||||
return existingDefinition.getBeanClassName().equals(ProxyFactoryBean.class.getName());
|
||||
return ProxyFactoryBean.class.getName().equals(existingDefinition.getBeanClassName());
|
||||
}
|
||||
|
||||
protected String getInterceptorNameSuffix(BeanDefinition interceptorDefinition) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue