Skip to content

Commit 5e10658

Browse files
committed
fixed isProxyFactoryBeanDefinition check (SPR-6842)
1 parent a6af91f commit 5e10658

File tree

1 file changed

+16
-15
lines changed

1 file changed

+16
-15
lines changed

org.springframework.aop/src/main/java/org/springframework/aop/config/AbstractInterceptorDrivenBeanDefinitionDecorator.java

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2006 the original author or authors.
2+
* Copyright 2002-2010 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -34,22 +34,25 @@
3434
import org.springframework.util.StringUtils;
3535

3636
/**
37-
* Base implementation for {@link org.springframework.beans.factory.xml.BeanDefinitionDecorator BeanDefinitionDecorators} wishing
38-
* to add an {@link org.aopalliance.intercept.MethodInterceptor interceptor} to the resulting
39-
* bean.
37+
* Base implementation for
38+
* {@link org.springframework.beans.factory.xml.BeanDefinitionDecorator BeanDefinitionDecorators}
39+
* wishing to add an {@link org.aopalliance.intercept.MethodInterceptor interceptor}
40+
* to the resulting bean.
4041
*
4142
* <p>This base class controls the creation of the {@link ProxyFactoryBean} bean definition
42-
* and wraps the original as an inner-bean definition for the <code>target</code> property of
43-
* {@link ProxyFactoryBean}.
43+
* and wraps the original as an inner-bean definition for the <code>target</code> property
44+
* of {@link ProxyFactoryBean}.
4445
*
4546
* <p>Chaining is correctly handled, ensuring that only one {@link ProxyFactoryBean} definition
46-
* is created. If a previous {@link org.springframework.beans.factory.xml.BeanDefinitionDecorator} already created the {@link org.springframework.aop.framework.ProxyFactoryBean}
47-
* then the interceptor is simply added to the existing definition.
47+
* is created. If a previous {@link org.springframework.beans.factory.xml.BeanDefinitionDecorator}
48+
* already created the {@link org.springframework.aop.framework.ProxyFactoryBean} then the
49+
* interceptor is simply added to the existing definition.
4850
*
49-
* <p>Subclasses have only to create the <code>BeanDefinition</code> to the interceptor they
50-
* wish to add.
51+
* <p>Subclasses have only to create the <code>BeanDefinition</code> to the interceptor that
52+
* they wish to add.
5153
*
5254
* @author Rob Harrop
55+
* @author Juergen Hoeller
5356
* @since 2.0
5457
* @see org.aopalliance.intercept.MethodInterceptor
5558
*/
@@ -72,7 +75,6 @@ public final BeanDefinitionHolder decorate(Node node, BeanDefinitionHolder defin
7275
BeanDefinitionHolder result = definitionHolder;
7376

7477
if (!isProxyFactoryBeanDefinition(existingDefinition)) {
75-
7678
// create the proxy definitionHolder
7779
RootBeanDefinition proxyDefinition = new RootBeanDefinition();
7880
// create proxy factory bean definitionHolder
@@ -93,18 +95,17 @@ public final BeanDefinitionHolder decorate(Node node, BeanDefinitionHolder defin
9395
}
9496

9597
addInterceptorNameToList(interceptorName, result.getBeanDefinition());
96-
9798
return result;
98-
9999
}
100100

101+
@SuppressWarnings("unchecked")
101102
private void addInterceptorNameToList(String interceptorName, BeanDefinition beanDefinition) {
102-
List list = (List) beanDefinition.getPropertyValues().getPropertyValue("interceptorNames").getValue();
103+
List<String> list = (List<String>) beanDefinition.getPropertyValues().getPropertyValue("interceptorNames").getValue();
103104
list.add(interceptorName);
104105
}
105106

106107
private boolean isProxyFactoryBeanDefinition(BeanDefinition existingDefinition) {
107-
return existingDefinition.getBeanClassName().equals(ProxyFactoryBean.class.getName());
108+
return ProxyFactoryBean.class.getName().equals(existingDefinition.getBeanClassName());
108109
}
109110

110111
protected String getInterceptorNameSuffix(BeanDefinition interceptorDefinition) {

0 commit comments

Comments
 (0)