16
16
17
17
package org .springframework .aop .config ;
18
18
19
+ import org .w3c .dom .Element ;
20
+
19
21
import org .springframework .beans .factory .config .BeanDefinition ;
20
22
import org .springframework .beans .factory .parsing .BeanComponentDefinition ;
21
- import org .springframework .beans .factory .parsing .ComponentRegistrar ;
22
- import org .springframework .beans .factory .parsing .ComponentRegistrarAdapter ;
23
23
import org .springframework .beans .factory .support .BeanDefinitionRegistry ;
24
24
import org .springframework .beans .factory .xml .ParserContext ;
25
- import org .w3c .dom .Element ;
26
25
27
26
/**
28
27
* Utility class for handling registration of auto-proxy creators used internally
@@ -53,41 +52,22 @@ public abstract class AopNamespaceUtils {
53
52
private static final String EXPOSE_PROXY_ATTRIBUTE = "expose-proxy" ;
54
53
55
54
56
- /**
57
- * @deprecated since Spring 3.1 in favor of
58
- * {@link #registerAutoProxyCreatorIfNecessary(BeanDefinitionRegistry, ComponentRegistrar, Object, Boolean, Boolean)}
59
- */
60
- @ Deprecated
61
55
public static void registerAutoProxyCreatorIfNecessary (
62
56
ParserContext parserContext , Element sourceElement ) {
63
57
64
58
BeanDefinition beanDefinition = AopConfigUtils .registerAutoProxyCreatorIfNecessary (
65
59
parserContext .getRegistry (), parserContext .extractSource (sourceElement ));
66
60
useClassProxyingIfNecessary (parserContext .getRegistry (), sourceElement );
67
- registerComponentIfNecessary (beanDefinition , new ComponentRegistrarAdapter (parserContext ));
68
- }
69
-
70
- public static void registerAutoProxyCreatorIfNecessary (
71
- BeanDefinitionRegistry registry , ComponentRegistrar parserContext , Object source , Boolean proxyTargetClass , Boolean exposeProxy ) {
72
-
73
- BeanDefinition beanDefinition =
74
- AopConfigUtils .registerAutoProxyCreatorIfNecessary (registry , source );
75
- useClassProxyingIfNecessary (registry , proxyTargetClass , exposeProxy );
76
61
registerComponentIfNecessary (beanDefinition , parserContext );
77
62
}
78
63
79
- public static void registerAutoProxyCreatorIfNecessary (
80
- BeanDefinitionRegistry registry , ComponentRegistrar parserContext , Object source , Boolean proxyTargetClass ) {
81
- registerAutoProxyCreatorIfNecessary (registry , parserContext , source , proxyTargetClass , false );
82
- }
83
-
84
64
public static void registerAspectJAutoProxyCreatorIfNecessary (
85
65
ParserContext parserContext , Element sourceElement ) {
86
66
87
67
BeanDefinition beanDefinition = AopConfigUtils .registerAspectJAutoProxyCreatorIfNecessary (
88
68
parserContext .getRegistry (), parserContext .extractSource (sourceElement ));
89
69
useClassProxyingIfNecessary (parserContext .getRegistry (), sourceElement );
90
- registerComponentIfNecessary (beanDefinition , new ComponentRegistrarAdapter ( parserContext ) );
70
+ registerComponentIfNecessary (beanDefinition , parserContext );
91
71
}
92
72
93
73
public static void registerAspectJAnnotationAutoProxyCreatorIfNecessary (
@@ -96,7 +76,7 @@ public static void registerAspectJAnnotationAutoProxyCreatorIfNecessary(
96
76
BeanDefinition beanDefinition = AopConfigUtils .registerAspectJAnnotationAutoProxyCreatorIfNecessary (
97
77
parserContext .getRegistry (), parserContext .extractSource (sourceElement ));
98
78
useClassProxyingIfNecessary (parserContext .getRegistry (), sourceElement );
99
- registerComponentIfNecessary (beanDefinition , new ComponentRegistrarAdapter ( parserContext ) );
79
+ registerComponentIfNecessary (beanDefinition , parserContext );
100
80
}
101
81
102
82
/**
@@ -108,7 +88,7 @@ public static void registerAspectJAnnotationAutoProxyCreatorIfNecessary(
108
88
public static void registerAutoProxyCreatorIfNecessary (ParserContext parserContext , Object source ) {
109
89
BeanDefinition beanDefinition = AopConfigUtils .registerAutoProxyCreatorIfNecessary (
110
90
parserContext .getRegistry (), source );
111
- registerComponentIfNecessary (beanDefinition , new ComponentRegistrarAdapter ( parserContext ) );
91
+ registerComponentIfNecessary (beanDefinition , parserContext );
112
92
}
113
93
114
94
/**
@@ -121,12 +101,6 @@ public static void forceAutoProxyCreatorToUseClassProxying(BeanDefinitionRegistr
121
101
}
122
102
123
103
124
- /**
125
- * @deprecated since Spring 3.1 in favor of
126
- * {@link #useClassProxyingIfNecessary(BeanDefinitionRegistry, Boolean, Boolean)}
127
- * which does not require a parameter of type org.w3c.dom.Element
128
- */
129
- @ Deprecated
130
104
private static void useClassProxyingIfNecessary (BeanDefinitionRegistry registry , Element sourceElement ) {
131
105
if (sourceElement != null ) {
132
106
boolean proxyTargetClass = Boolean .valueOf (sourceElement .getAttribute (PROXY_TARGET_CLASS_ATTRIBUTE ));
@@ -140,20 +114,11 @@ private static void useClassProxyingIfNecessary(BeanDefinitionRegistry registry,
140
114
}
141
115
}
142
116
143
- private static void useClassProxyingIfNecessary (BeanDefinitionRegistry registry , Boolean proxyTargetClass , Boolean exposeProxy ) {
144
- if (proxyTargetClass ) {
145
- AopConfigUtils .forceAutoProxyCreatorToUseClassProxying (registry );
146
- }
147
- if (exposeProxy ) {
148
- AopConfigUtils .forceAutoProxyCreatorToExposeProxy (registry );
149
- }
150
- }
151
-
152
- private static void registerComponentIfNecessary (BeanDefinition beanDefinition , ComponentRegistrar componentRegistrar ) {
117
+ private static void registerComponentIfNecessary (BeanDefinition beanDefinition , ParserContext parserContext ) {
153
118
if (beanDefinition != null ) {
154
119
BeanComponentDefinition componentDefinition =
155
120
new BeanComponentDefinition (beanDefinition , AopConfigUtils .AUTO_PROXY_CREATOR_BEAN_NAME );
156
- componentRegistrar .registerComponent (componentDefinition );
121
+ parserContext .registerComponent (componentDefinition );
157
122
}
158
123
}
159
124
0 commit comments