近,二狗子入职了新公司,新入职的那几天确实有点飘。不过慢慢的,他发现他身边的人各个身怀绝技啊,有Spring源码的贡献者,有Dubbo源码的贡献者,有MyBatis源码的贡献者,还有研究AI的大佬,个个都是大神级别的人物。二狗子有点慌,想起自己虽然入职了,但是比起其他人确实差点远啊。怎么办呢?先从基础补起呗,他发现自己对于Spring的理解还不算太深。于是乎,他让我给他讲讲Spring的@EnableAspectJAutoProxy注解。
如果文章对你有点帮助,请点个赞,给个在看和转发,大家的三连是我持续创作的最大动力!
@EnableAspectJAutoProxy注解 在配置类上添加@EnableAspectJAutoProxy注解,能够开启注解版的AOP功能。也就是说,AOP中如果要使注解版的AOP功能起作用,就需要在配置类上添加@EnableAspectJAutoProxy注解。 我们先来看下@EnableAspectJAutoProxy注解的源码,如下所示。
package org.springframework.context.annotation; import java.lang.annotation.Documented; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; @Target(ElementType.TYPE) @Retention(RetentionPolicy.RUNTIME) @Documented @Import(AspectJAutoProxyRegistrar.class) public @interface EnableAspectJAutoProxy { boolean proxyTargetClass() default false; boolean exposeProxy() default false; } 从源码可以看出,@EnableAspectJAutoProxy使用@Import注解引入了AspectJAutoProxyRegister.class对象 。那么,AspectJAutoProxyRegistrar又是什么呢?我们继续点击到AspectJAutoProxyRegistrar类的源码中,如下所示。
package org.springframework.context.annotation; import org.springframework.aop.config.AopConfigUtils; import org.springframework.beans.factory.support.BeanDefinitionRegistry; import org.springframework.core.annotation.AnnotationAttributes; import org.springframework.core.type.AnnotationMetadata; class AspectJAutoProxyRegistrar implements ImportBeanDefinitionRegistrar { @Override public void registerBeanDefinitions( AnnotationMetadata importingClassMetadata, BeanDefinitionRegistry registry) {
AopConfigUtils.registerAspectJAnnotationAutoProxyCreatorIfNecessary(registry); AnnotationAttributes enableAspectJAutoProxy = AnnotationConfigUtils.attributesFor(importingClassMetadata, EnableAspectJAutoProxy.class); if (enableAspectJAutoProxy != null) { if (enableAspectJAutoProxy.getBoolean("proxyTargetClass")) { AopConfigUtils.forceAutoProxyCreatorToUseClassProxying(registry); } if (enableAspectJAutoProxy.getBoolean("exposeProxy")) { AopConfigUtils.forceAutoProxyCreatorToExposeProxy(registry); } } }} 可以看到AspectJAutoProxyRegistrar类实现了ImportBeanDefinitionRegistrar接口。看下ImportBeanDefinitionRegistrar接口的定义,如下所示。
package org.springframework.context.annotation;
import org.springframework.beans.factory.support.BeanDefinitionRegistry; import org.springframework.beans.factory.support.BeanDefinitionRegistryPostProcessor; import org.springframework.beans.factory.support.BeanNameGenerator; import org.springframework.core.type.AnnotationMetadata; public interface ImportBeanDefinitionRegistrar {
default void registerBeanDefinitions(AnnotationMetadata importingClassMetadata, BeanDefinitionRegistry registry, BeanNameGenerator importBeanNameGenerator) { registerBeanDefinitions(importingClassMetadata, registry); } default void registerBeanDefinitions(AnnotationMetadata importingClassMetadata, BeanDefinitionRegistry registry) { }看到ImportBeanDefinitionRegistrar接口,小伙伴们是不是觉得很熟悉呢。没错,我们在【Spring注解驱动开发】专题前面的文章中介绍过。可以通过ImportBeanDefinitionRegistrar接口实现将自定义的组件添加到IOC容器中。
也就说,@EnableAspectJAutoProxy注解使用AspectJAutoProxyRegistrar对象自定义组件,并将相应的组件添加到IOC容器中。
调试Spring源码 我们在AspectJAutoProxyRegistrar类的registerBeanDefinitions()方法中设置断点,如下所示。
接下来,我们以debug的方法来运行AopTest类的testAop01()方法。运行后程序进入到断点位置,如下所示。
可以看到,程序已经暂停在断点位置,而且在IDEA的左下角显示了方法的调用栈。
在AspectJAutoProxyRegistrar类的registerBeanDefinitions()方法,首先调用AopConfigUtils类的registerAspectJAnnotationAutoProxyCreatorIfNecessary()方法来注册registry。单看registerAspectJAnnotationAutoProxyCreatorIfNecessary()方法也不难理解,字面含义就是:如果需要的话注册一个AspectJAnnotationAutoProxyCreator。
接下来,我们进入到AopConfigUtils类的registerAspectJAnnotationAutoProxyCreatorIfNecessary()方法中,如下所示。
在AopConfigUtils类的registerAspectJAnnotationAutoProxyCreatorIfNecessary()方法中,直接调用了重载的registerAspectJAnnotationAutoProxyCreatorIfNecessary()方法,我们继续跟代码,如下所示。
可以看到在重载的registerAspectJAnnotationAutoProxyCreatorIfNecessary()方法中直接调用了registerOrEscalateApcAsRequired()方法。在registerOrEscalateApcAsRequired()方法中,传入了AnnotationAwareAspectJAutoProxyCreator.class对象。
我们继续跟进代码,如下所示。
我们可以看到,在registerOrEscalateApcAsRequired()方法中,接收到的Class对象的类型为:org.springframework.aop.aspectj.annotation.AnnotationAwareAspectJAutoProxyCreator。
在registerOrEscalateApcAsRequired()方法中方法中,首先判断registry是否包含org.springframework.aop.config.internalAutoProxyCreator类型的bean。如下所示。
如果registry中包含org.springframework.aop.config.internalAutoProxyCreator类型的bean,则进行相应的处理,从Spring的源码来看,就是将org.springframework.aop.config.internalAutoProxyCreator类型的bean从registry中取出,并且判断cls对象的name值和apcDefinition的beanClassName值是否相等,如果不相等。则获取apcDefinition和cls的优先级,如果apcDefinition的优先级小于cls的优先级,则将apcDefinition的beanClassName设置为cls的name值。相对来说,理解起来还是比较简单的。
我们这里是第一次运行程序,不会进入到 if 条件中,我们继续看代码,如下所示。
这里,使用RootBeanDefinition来创建一个beanDefinition,并且将org.springframework.aop.aspectj.annotation.AnnotationAwareAspectJAutoProxyCreator的Class对象作为参数传递进来。
我们继续往下看代码,最终AopConfigUtils类的registerOrEscalateApcAsRequired()方法中,会通过registry调用registerBeanDefinition()方法注册组件,如下所示。
并且注册的bean的名称为org.springframework.aop.config.internalAutoProxyCreator。
接下来,我们继续看AspectJAutoProxyRegistrar类的registerBeanDefinitions()源码,如下所示。
通过AnnotationConfigUtils类的attributesFor方法来获取@EnableAspectJAutoProxy注解的信息。接下来,就是判断proxyTargetClass属性的值是否为true,如果为true则调用AopConfigUtils类的forceAutoProxyCreatorToUseClassProxying()方法;继续判断exposeProxy属性的值是否为true,如果为true则调用AopConfigUtils类的forceAutoProxyCreatorToExposeProxy()方法。
综上,向Spring的配置类上添加@EnableAspectJAutoProxy注解后,会向IOC容器中注册AnnotationAwareAspectJAutoProxyCreator。
接下来,我们来看下AnnotationAwareAspectJAutoProxyCreator类的结构图。 http://bbs.quyouji.com/topic.asp?id=1090 http://bbs.quyouji.com/topic.asp?id=1091 http://bbs.quyouji.com/topic.asp?id=1092 http://bbs.quyouji.com/topic.asp?id=1093 http://bbs.quyouji.com/topic.asp?id=1094 http://bbs.quyouji.com/topic.asp?id=1095 http://bbs.quyouji.com/topic.asp?id=1096 http://bbs.quyouji.com/topic.asp?id=1097 http://bbs.quyouji.com/topic.asp?id=1098 http://bbs.quyouji.com/topic.asp?id=1099 http://bbs.quyouji.com/topic.asp?id=1100 http://bbs.quyouji.com/topic.asp?id=1101 http://bbs.quyouji.com/topic.asp?id=1102 http://bbs.quyouji.com/topic.asp?id=1103 http://bbs.quyouji.com/topic.asp?id=1104 http://bbs.quyouji.com/topic.asp?id=1105 http://bbs.quyouji.com/topic.asp?id=1106 http://bbs.quyouji.com/topic.asp?id=1107 http://bbs.quyouji.com/topic.asp?id=1108 http://bbs.quyouji.com/topic.asp?id=1109 http://bbs.quyouji.com/topic.asp?id=1110 http://bbs.quyouji.com/topic.asp?id=1111 http://bbs.quyouji.com/topic.asp?id=1112 http://bbs.quyouji.com/topic.asp?id=1113 http://bbs.quyouji.com/topic.asp?id=1114 http://bbs.quyouji.com/topic.asp?id=1115 http://bbs.quyouji.com/topic.asp?id=1116 http://bbs.quyouji.com/topic.asp?id=1117 http://bbs.quyouji.com/topic.asp?id=1118 http://bbs.quyouji.com/topic.asp?id=1119 http://bbs.quyouji.com/topic.asp?id=1120 http://bbs.quyouji.com/topic.asp?id=1121 http://bbs.quyouji.com/topic.asp?id=1122 http://bbs.quyouji.com/topic.asp?id=1123 http://bbs.quyouji.com/topic.asp?id=1124 http://bbs.quyouji.com/topic.asp?id=1125 http://bbs.quyouji.com/topic.asp?id=1126 http://bbs.quyouji.com/topic.asp?id=1127 http://bbs.quyouji.com/topic.asp?id=1128 http://bbs.quyouji.com/topic.asp?id=1129 http://bbs.quyouji.com/topic.asp?id=1130 http://bbs.quyouji.com/topic.asp?id=1131 http://bbs.quyouji.com/topic.asp?id=1132 http://bbs.quyouji.com/topic.asp?id=1133 http://bbs.quyouji.com/topic.asp?id=1134 http://bbs.quyouji.com/topic.asp?id=1135 http://bbs.quyouji.com/topic.asp?id=1136 http://bbs.quyouji.com/topic.asp?id=1137 http://bbs.quyouji.com/topic.asp?id=1138 http://bbs.quyouji.com/topic.asp?id=1139 http://bbs.quyouji.com/topic.asp?id=1140 http://bbs.quyouji.com/topic.asp?id=1141 http://bbs.quyouji.com/topic.asp?id=1142 http://bbs.quyouji.com/topic.asp?id=1143 http://bbs.quyouji.com/topic.asp?id=1144 http://bbs.quyouji.com/topic.asp?id=1145 http://bbs.quyouji.com/topic.asp?id=1146 http://bbs.quyouji.com/topic.asp?id=1147 http://bbs.quyouji.com/topic.asp?id=1148 http://bbs.quyouji.com/topic.asp?id=1149 http://bbs.quyouji.com/topic.asp?id=1150 http://bbs.quyouji.com/topic.asp?id=1151 http://bbs.quyouji.com/topic.asp?id=1152 http://bbs.quyouji.com/topic.asp?id=1153 http://bbs.quyouji.com/topic.asp?id=1154 http://bbs.quyouji.com/topic.asp?id=1155 http://bbs.quyouji.com/topic.asp?id=1156 http://bbs.quyouji.com/topic.asp?id=1157 http://bbs.quyouji.com/topic.asp?id=1158 http://bbs.quyouji.com/topic.asp?id=1159 http://bbs.quyouji.com/topic.asp?id=1160 http://bbs.quyouji.com/topic.asp?id=1161 http://bbs.quyouji.com/topic.asp?id=1162 http://bbs.quyouji.com/topic.asp?id=1163 http://bbs.quyouji.com/topic.asp?id=1164 http://bbs.quyouji.com/topic.asp?id=1165 http://bbs.quyouji.com/topic.asp?id=1166 http://bbs.quyouji.com/topic.asp?id=1167 http://bbs.quyouji.com/topic.asp?id=1168 http://bbs.quyouji.com/topic.asp?id=1169 http://bbs.quyouji.com/topic.asp?id=1170 http://bbs.quyouji.com/topic.asp?id=1171 http://bbs.quyouji.com/topic.asp?id=1172 http://bbs.quyouji.com/topic.asp?id=1173 http://bbs.quyouji.com/topic.asp?id=1174 http://bbs.quyouji.com/topic.asp?id=1175 http://bbs.quyouji.com/topic.asp?id=1176 http://bbs.quyouji.com/topic.asp?id=1177 http://bbs.quyouji.com/topic.asp?id=1178 http://bbs.quyouji.com/topic.asp?id=1179 http://bbs.quyouji.com/topic.asp?id=1180 http://bbs.quyouji.com/topic.asp?id=1181 http://bbs.quyouji.com/topic.asp?id=1182 http://bbs.quyouji.com/topic.asp?id=1183 http://bbs.quyouji.com/topic.asp?id=1184 http://bbs.quyouji.com/topic.asp?id=1185 http://bbs.quyouji.com/topic.asp?id=1186 http://bbs.quyouji.com/topic.asp?id=1187 http://bbs.quyouji.com/topic.asp?id=1188 http://bbs.quyouji.com/topic.asp?id=1189 http://bbs.quyouji.com/topic.asp?id=1190 http://bbs.quyouji.com/topic.asp?id=1191 http://bbs.quyouji.com/topic.asp?id=1192 http://bbs.quyouji.com/topic.asp?id=1193 http://bbs.quyouji.com/topic.asp?id=1194 http://bbs.quyouji.com/topic.asp?id=1195 http://bbs.quyouji.com/topic.asp?id=1196 http://bbs.quyouji.com/topic.asp?id=1197 http://bbs.quyouji.com/topic.asp?id=1198 http://bbs.quyouji.com/topic.asp?id=1199 http://bbs.quyouji.com/topic.asp?id=1200 http://bbs.quyouji.com/topic.asp?id=1201 http://bbs.quyouji.com/topic.asp?id=1202 http://bbs.quyouji.com/topic.asp?id=1203 http://bbs.quyouji.com/topic.asp?id=1204 http://bbs.quyouji.com/topic.asp?id=1205 http://bbs.quyouji.com/topic.asp?id=1206 http://bbs.quyouji.com/topic.asp?id=1207 http://bbs.quyouji.com/topic.asp?id=1208 http://bbs.quyouji.com/topic.asp?id=1209 http://bbs.quyouji.com/topic.asp?id=1210 http://bbs.quyouji.com/topic.asp?id=1211 http://bbs.quyouji.com/topic.asp?id=1212 http://bbs.quyouji.com/topic.asp?id=1213 http://bbs.quyouji.com/topic.asp?id=1214 http://bbs.quyouji.com/topic.asp?id=1215 http://bbs.quyouji.com/topic.asp?id=1216 http://bbs.quyouji.com/topic.asp?id=1217 http://bbs.quyouji.com/topic.asp?id=1218 http://bbs.quyouji.com/topic.asp?id=1219 http://bbs.quyouji.com/topic.asp?id=1220 http://bbs.quyouji.com/topic.asp?id=1221 http://bbs.quyouji.com/topic.asp?id=1222 http://bbs.quyouji.com/topic.asp?id=1223 http://bbs.quyouji.com/topic.asp?id=1224 http://bbs.quyouji.com/topic.asp?id=1225 http://bbs.quyouji.com/topic.asp?id=1226 http://bbs.quyouji.com/topic.asp?id=1227 http://bbs.quyouji.com/topic.asp?id=1228 http://bbs.quyouji.com/topic.asp?id=1229 http://bbs.quyouji.com/topic.asp?id=1230 http://bbs.quyouji.com/topic.asp?id=1231 http://bbs.quyouji.com/topic.asp?id=1232 http://bbs.quyouji.com/topic.asp?id=1233 http://bbs.quyouji.com/topic.asp?id=1234 http://bbs.quyouji.com/topic.asp?id=1235 http://bbs.quyouji.com/topic.asp?id=1236 http://bbs.quyouji.com/topic.asp?id=1237 http://bbs.quyouji.com/topic.asp?id=1238 http://bbs.quyouji.com/topic.asp?id=1239 http://bbs.quyouji.com/topic.asp?id=1240 http://bbs.quyouji.com/topic.asp?id=1241 http://bbs.quyouji.com/topic.asp?id=1242 http://bbs.quyouji.com/topic.asp?id=1243 http://bbs.quyouji.com/topic.asp?id=1244 http://bbs.quyouji.com/topic.asp?id=1245 http://bbs.quyouji.com/topic.asp?id=1246 http://bbs.quyouji.com/topic.asp?id=1247 http://bbs.quyouji.com/topic.asp?id=1248 http://bbs.quyouji.com/topic.asp?id=1249 http://bbs.quyouji.com/topic.asp?id=1250 http://bbs.quyouji.com/topic.asp?id=1251 http://bbs.quyouji.com/topic.asp?id=1252 http://bbs.quyouji.com/topic.asp?id=1253 http://bbs.quyouji.com/topic.asp?id=1254 http://bbs.quyouji.com/topic.asp?id=1255 http://bbs.quyouji.com/topic.asp?id=1256 http://bbs.quyouji.com/topic.asp?id=1257 http://bbs.quyouji.com/topic.asp?id=1258 http://bbs.quyouji.com/topic.asp?id=1259 http://bbs.quyouji.com/topic.asp?id=1260 http://bbs.quyouji.com/topic.asp?id=1261 http://bbs.quyouji.com/topic.asp?id=1262 http://bbs.quyouji.com/topic.asp?id=1263 http://bbs.quyouji.com/topic.asp?id=1264 http://bbs.quyouji.com/topic.asp?id=1265 http://bbs.quyouji.com/topic.asp?id=1266 http://bbs.quyouji.com/topic.asp?id=1267 http://bbs.quyouji.com/topic.asp?id=1268 http://bbs.quyouji.com/topic.asp?id=1269 http://bbs.quyouji.com/topic.asp?id=1270 http://bbs.quyouji.com/topic.asp?id=1271 http://bbs.quyouji.com/topic.asp?id=1272 http://bbs.quyouji.com/topic.asp?id=1273 http://bbs.quyouji.com/topic.asp?id=1274 http://bbs.quyouji.com/topic.asp?id=1275 http://bbs.quyouji.com/topic.asp?id=1276 http://bbs.quyouji.com/topic.asp?id=1277 http://bbs.quyouji.com/topic.asp?id=1278 http://bbs.quyouji.com/topic.asp?id=1279 http://bbs.quyouji.com/topic.asp?id=1280 http://bbs.quyouji.com/topic.asp?id=1281 http://bbs.quyouji.com/topic.asp?id=1282 http://bbs.quyouji.com/topic.asp?id=1283 http://bbs.quyouji.com/topic.asp?id=1284 http://bbs.quyouji.com/topic.asp?id=1285 http://bbs.quyouji.com/topic.asp?id=1286 http://bbs.quyouji.com/topic.asp?id=1287 http://bbs.quyouji.com/topic.asp?id=1288 http://bbs.quyouji.com/topic.asp?id=1289 http://bbs.quyouji.com/topic.asp?id=1290 http://bbs.quyouji.com/topic.asp?id=1291 http://bbs.quyouji.com/topic.asp?id=1292 http://bbs.quyouji.com/topic.asp?id=1293 http://bbs.quyouji.com/topic.asp?id=1294 http://bbs.quyouji.com/topic.asp?id=1295 http://bbs.quyouji.com/topic.asp?id=1296 http://bbs.quyouji.com/topic.asp?id=1297 http://bbs.quyouji.com/topic.asp?id=1298 http://bbs.quyouji.com/topic.asp?id=1299 http://bbs.quyouji.com/topic.asp?id=1300 http://bbs.quyouji.com/topic.asp?id=1301 http://bbs.quyouji.com/topic.asp?id=1302 http://bbs.quyouji.com/topic.asp?id=1303 http://bbs.quyouji.com/topic.asp?id=1304 http://bbs.quyouji.com/topic.asp?id=1305 http://bbs.quyouji.com/topic.asp?id=1306 http://bbs.quyouji.com/topic.asp?id=1307 http://bbs.quyouji.com/topic.asp?id=1308 http://bbs.quyouji.com/topic.asp?id=1309 http://bbs.quyouji.com/topic.asp?id=1310 http://bbs.quyouji.com/topic.asp?id=1311 http://bbs.quyouji.com/topic.asp?id=1312 http://bbs.quyouji.com/topic.asp?id=1313 http://bbs.quyouji.com/topic.asp?id=1314 http://bbs.quyouji.com/topic.asp?id=1315 http://bbs.quyouji.com/topic.asp?id=1316 http://bbs.quyouji.com/topic.asp?id=1317 http://bbs.quyouji.com/topic.asp?id=1318 http://bbs.quyouji.com/topic.asp?id=1319 http://bbs.quyouji.com/topic.asp?id=1320 http://bbs.quyouji.com/topic.asp?id=1321 http://bbs.quyouji.com/topic.asp?id=1322 http://bbs.quyouji.com/topic.asp?id=1323 http://bbs.quyouji.com/topic.asp?id=1324 http://bbs.quyouji.com/topic.asp?id=1325 http://bbs.quyouji.com/topic.asp?id=1326 http://bbs.quyouji.com/topic.asp?id=1327 http://bbs.quyouji.com/topic.asp?id=1328 http://bbs.quyouji.com/topic.asp?id=1329 http://bbs.quyouji.com/topic.asp?id=1330 http://bbs.quyouji.com/topic.asp?id=1331 http://bbs.quyouji.com/topic.asp?id=1332 http://bbs.quyouji.com/topic.asp?id=1333 http://bbs.quyouji.com/topic.asp?id=1334 http://bbs.quyouji.com/topic.asp?id=1335 http://bbs.quyouji.com/topic.asp?id=1336 http://bbs.quyouji.com/topic.asp?id=1337 http://bbs.quyouji.com/topic.asp?id=1338 http://bbs.quyouji.com/topic.asp?id=1339 http://bbs.quyouji.com/topic.asp?id=1340 http://bbs.quyouji.com/topic.asp?id=1341 http://bbs.quyouji.com/topic.asp?id=1342 http://bbs.quyouji.com/topic.asp?id=1343 http://bbs.quyouji.com/topic.asp?id=1344 http://bbs.quyouji.com/topic.asp?id=1345 http://bbs.quyouji.com/topic.asp?id=1346 http://bbs.quyouji.com/topic.asp?id=1347 http://bbs.quyouji.com/topic.asp?id=1348 http://bbs.quyouji.com/topic.asp?id=1349 http://bbs.quyouji.com/topic.asp?id=1350 http://bbs.quyouji.com/topic.asp?id=1351 http://bbs.quyouji.com/topic.asp?id=1352 http://bbs.quyouji.com/topic.asp?id=1353 http://bbs.quyouji.com/topic.asp?id=1354 http://bbs.quyouji.com/topic.asp?id=1355 http://bbs.quyouji.com/topic.asp?id=1356 http://bbs.quyouji.com/topic.asp?id=1357 http://bbs.quyouji.com/topic.asp?id=1358 http://bbs.quyouji.com/topic.asp?id=1359 http://bbs.quyouji.com/topic.asp?id=1360 http://bbs.quyouji.com/topic.asp?id=1361 http://bbs.quyouji.com/topic.asp?id=1362 http://bbs.quyouji.com/topic.asp?id=1363 http://bbs.quyouji.com/topic.asp?id=1364 http://bbs.quyouji.com/topic.asp?id=1365 http://bbs.quyouji.com/topic.asp?id=1366 http://bbs.quyouji.com/topic.asp?id=1367 http://bbs.quyouji.com/topic.asp?id=1368 http://bbs.quyouji.com/topic.asp?id=1369 http://bbs.quyouji.com/topic.asp?id=1370 http://bbs.quyouji.com/topic.asp?id=1371 http://bbs.quyouji.com/topic.asp?id=1372 http://bbs.quyouji.com/topic.asp?id=1373 http://bbs.quyouji.com/topic.asp?id=1374 http://bbs.quyouji.com/topic.asp?id=1375 http://bbs.quyouji.com/topic.asp?id=1376 http://bbs.quyouji.com/topic.asp?id=1377 http://bbs.quyouji.com/topic.asp?id=1378 http://bbs.quyouji.com/topic.asp?id=1379 http://bbs.quyouji.com/topic.asp?id=1380 http://bbs.quyouji.com/topic.asp?id=1381 http://bbs.quyouji.com/topic.asp?id=1382 http://bbs.quyouji.com/topic.asp?id=1383 http://bbs.quyouji.com/topic.asp?id=1384 http://bbs.quyouji.com/topic.asp?id=1385 http://bbs.quyouji.com/topic.asp?id=1386 http://bbs.quyouji.com/topic.asp?id=1387 http://bbs.quyouji.com/topic.asp?id=1388 http://bbs.quyouji.com/topic.asp?id=1389 http://bbs.quyouji.com/topic.asp?id=1390 http://bbs.quyouji.com/topic.asp?id=1391 http://bbs.quyouji.com/topic.asp?id=1392 http://bbs.quyouji.com/topic.asp?id=1393 http://bbs.quyouji.com/topic.asp?id=1394 http://bbs.quyouji.com/topic.asp?id=1395 http://bbs.quyouji.com/topic.asp?id=1396 http://bbs.quyouji.com/topic.asp?id=1397 http://bbs.quyouji.com/topic.asp?id=1398 http://bbs.quyouji.com/topic.asp?id=1399 http://bbs.quyouji.com/topic.asp?id=1400 http://bbs.quyouji.com/topic.asp?id=1401 http://bbs.quyouji.com/topic.asp?id=1402 http://bbs.quyouji.com/topic.asp?id=1403 http://bbs.quyouji.com/topic.asp?id=1404 http://bbs.quyouji.com/topic.asp?id=1405 http://bbs.quyouji.com/topic.asp?id=1406 http://bbs.quyouji.com/topic.asp?id=1407 http://bbs.quyouji.com/topic.asp?id=1408 http://bbs.quyouji.com/topic.asp?id=1409 http://bbs.quyouji.com/topic.asp?id=1410 http://bbs.quyouji.com/topic.asp?id=1411 http://bbs.quyouji.com/topic.asp?id=1412 http://bbs.quyouji.com/topic.asp?id=1413 http://bbs.quyouji.com/topic.asp?id=1414 http://bbs.quyouji.com/topic.asp?id=1415 http://bbs.quyouji.com/topic.asp?id=1416 http://bbs.quyouji.com/topic.asp?id=1417 http://bbs.quyouji.com/topic.asp?id=1418 http://bbs.quyouji.com/topic.asp?id=1419 http://bbs.quyouji.com/topic.asp?id=1420 http://bbs.quyouji.com/topic.asp?id=1421 http://bbs.quyouji.com/topic.asp?id=1422 http://bbs.quyouji.com/topic.asp?id=1423 http://bbs.quyouji.com/topic.asp?id=1424 http://bbs.quyouji.com/topic.asp?id=1425 http://bbs.quyouji.com/topic.asp?id=1426 http://bbs.quyouji.com/topic.asp?id=1427 http://bbs.quyouji.com/topic.asp?id=1428 http://bbs.quyouji.com/topic.asp?id=1429 http://bbs.quyouji.com/topic.asp?id=1430 http://bbs.quyouji.com/topic.asp?id=1431 http://bbs.quyouji.com/topic.asp?id=1432 http://bbs.quyouji.com/topic.asp?id=1433 http://bbs.quyouji.com/topic.asp?id=1434 http://bbs.quyouji.com/topic.asp?id=1435 http://bbs.quyouji.com/topic.asp?id=1436 http://bbs.quyouji.com/topic.asp?id=1437 http://bbs.quyouji.com/topic.asp?id=1438 http://bbs.quyouji.com/topic.asp?id=1439 http://bbs.quyouji.com/topic.asp?id=1440 http://bbs.quyouji.com/topic.asp?id=1441 http://bbs.quyouji.com/topic.asp?id=1442 http://bbs.quyouji.com/topic.asp?id=1443 http://bbs.quyouji.com/topic.asp?id=1444 http://bbs.quyouji.com/topic.asp?id=1445 http://bbs.quyouji.com/topic.asp?id=1446 http://bbs.quyouji.com/topic.asp?id=1447 http://bbs.quyouji.com/topic.asp?id=1448 http://bbs.quyouji.com/topic.asp?id=1449 http://bbs.quyouji.com/topic.asp?id=1450 http://bbs.quyouji.com/topic.asp?id=1451 http://bbs.quyouji.com/topic.asp?id=1452 http://bbs.quyouji.com/topic.asp?id=1453 http://bbs.quyouji.com/topic.asp?id=1454 http://bbs.quyouji.com/topic.asp?id=1455 http://bbs.quyouji.com/topic.asp?id=1456 http://bbs.quyouji.com/topic.asp?id=1457 http://bbs.quyouji.com/topic.asp?id=1458 http://bbs.quyouji.com/topic.asp?id=1459 http://bbs.quyouji.com/topic.asp?id=1460 http://bbs.quyouji.com/topic.asp?id=1461 http://bbs.quyouji.com/topic.asp?id=1462 http://bbs.quyouji.com/topic.asp?id=1463 http://bbs.quyouji.com/topic.asp?id=1464 http://bbs.quyouji.com/topic.asp?id=1465 http://bbs.quyouji.com/topic.asp?id=1466 http://bbs.quyouji.com/topic.asp?id=1467 http://bbs.quyouji.com/topic.asp?id=1468 http://bbs.quyouji.com/topic.asp?id=1469 http://bbs.quyouji.com/topic.asp?id=1470 http://bbs.quyouji.com/topic.asp?id=1471 http://bbs.quyouji.com/topic.asp?id=1472 http://bbs.quyouji.com/topic.asp?id=1473 http://bbs.quyouji.com/topic.asp?id=1474 http://bbs.quyouji.com/topic.asp?id=1475 http://bbs.quyouji.com/topic.asp?id=1476 http://bbs.quyouji.com/topic.asp?id=1477 http://bbs.quyouji.com/topic.asp?id=1478 http://bbs.quyouji.com/topic.asp?id=1479 http://bbs.quyouji.com/topic.asp?id=1480 http://bbs.quyouji.com/topic.asp?id=1481 http://bbs.quyouji.com/topic.asp?id=1482 http://bbs.quyouji.com/topic.asp?id=1483 http://bbs.quyouji.com/topic.asp?id=1484 http://bbs.quyouji.com/topic.asp?id=1485 http://bbs.quyouji.com/topic.asp?id=1486 http://bbs.quyouji.com/topic.asp?id=1487 http://bbs.quyouji.com/topic.asp?id=1488 http://bbs.quyouji.com/topic.asp?id=1489 http://bbs.quyouji.com/topic.asp?id=1490 http://bbs.quyouji.com/topic.asp?id=1491 http://bbs.quyouji.com/topic.asp?id=1492 http://bbs.quyouji.com/topic.asp?id=1493 http://bbs.quyouji.com/topic.asp?id=1494 http://bbs.quyouji.com/topic.asp?id=1495 http://bbs.quyouji.com/topic.asp?id=1496 http://bbs.quyouji.com/topic.asp?id=1497 http://bbs.quyouji.com/topic.asp?id=1498 http://bbs.quyouji.com/topic.asp?id=1499 http://bbs.quyouji.com/topic.asp?id=1500 http://bbs.quyouji.com/topic.asp?id=1501 http://bbs.quyouji.com/topic.asp?id=1502 http://bbs.quyouji.com/topic.asp?id=1503 http://bbs.quyouji.com/topic.asp?id=1504 http://bbs.quyouji.com/topic.asp?id=1505 http://bbs.quyouji.com/topic.asp?id=1506 http://bbs.quyouji.com/topic.asp?id=1507 http://bbs.quyouji.com/topic.asp?id=1508 http://bbs.quyouji.com/topic.asp?id=1509 http://bbs.quyouji.com/topic.asp?id=1510 http://bbs.quyouji.com/topic.asp?id=1511 http://bbs.quyouji.com/topic.asp?id=1512 http://bbs.quyouji.com/topic.asp?id=1513 http://bbs.quyouji.com/topic.asp?id=1514 http://bbs.quyouji.com/topic.asp?id=1515 http://bbs.quyouji.com/topic.asp?id=1516 http://bbs.quyouji.com/topic.asp?id=1517 http://bbs.quyouji.com/topic.asp?id=1518 http://bbs.quyouji.com/topic.asp?id=1519 http://bbs.quyouji.com/topic.asp?id=1520 http://bbs.quyouji.com/topic.asp?id=1521 http://bbs.quyouji.com/topic.asp?id=1522 http://bbs.quyouji.com/topic.asp?id=1523 http://bbs.quyouji.com/topic.asp?id=1524 http://bbs.quyouji.com/topic.asp?id=1525 http://bbs.quyouji.com/topic.asp?id=1526 http://bbs.quyouji.com/topic.asp?id=1527 http://bbs.quyouji.com/topic.asp?id=1528 http://bbs.quyouji.com/topic.asp?id=1529 http://bbs.quyouji.com/topic.asp?id=1530 http://bbs.quyouji.com/topic.asp?id=1531 http://bbs.quyouji.com/topic.asp?id=1532 http://bbs.quyouji.com/topic.asp?id=1533 http://bbs.quyouji.com/topic.asp?id=1534 http://bbs.quyouji.com/topic.asp?id=1535 http://bbs.quyouji.com/topic.asp?id=1536 http://bbs.quyouji.com/topic.asp?id=1537 http://bbs.quyouji.com/topic.asp?id=1538 http://bbs.quyouji.com/topic.asp?id=1539 http://bbs.quyouji.com/topic.asp?id=1540 http://bbs.quyouji.com/topic.asp?id=1541 http://bbs.quyouji.com/topic.asp?id=1542 http://bbs.quyouji.com/topic.asp?id=1543 http://bbs.quyouji.com/topic.asp?id=1544 http://bbs.quyouji.com/topic.asp?id=1545 http://bbs.quyouji.com/topic.asp?id=1546 http://bbs.quyouji.com/topic.asp?id=1547 http://bbs.quyouji.com/topic.asp?id=1548 http://bbs.quyouji.com/topic.asp?id=1549 http://bbs.quyouji.com/topic.asp?id=1550 http://bbs.quyouji.com/topic.asp?id=1551 http://bbs.quyouji.com/topic.asp?id=1552 http://bbs.quyouji.com/topic.asp?id=1553 http://bbs.quyouji.com/topic.asp?id=1554 http://bbs.quyouji.com/topic.asp?id=1555 http://bbs.quyouji.com/topic.asp?id=1556 http://bbs.quyouji.com/topic.asp?id=1557 http://bbs.quyouji.com/topic.asp?id=1558 http://bbs.quyouji.com/topic.asp?id=1559 http://bbs.quyouji.com/topic.asp?id=1560 http://bbs.quyouji.com/topic.asp?id=1561 http://bbs.quyouji.com/topic.asp?id=1562 http://bbs.quyouji.com/topic.asp?id=1563 http://bbs.quyouji.com/topic.asp?id=1564 http://bbs.quyouji.com/topic.asp?id=1565 http://bbs.quyouji.com/topic.asp?id=1566 http://bbs.quyouji.com/topic.asp?id=1567 http://bbs.quyouji.com/topic.asp?id=1568 http://bbs.quyouji.com/topic.asp?id=1569 http://bbs.quyouji.com/topic.asp?id=1570 http://bbs.quyouji.com/topic.asp?id=1571 http://bbs.quyouji.com/topic.asp?id=1572 http://bbs.quyouji.com/topic.asp?id=1573 http://bbs.quyouji.com/topic.asp?id=1574 http://bbs.quyouji.com/topic.asp?id=1575 http://bbs.quyouji.com/topic.asp?id=1576 http://bbs.quyouji.com/topic.asp?id=1577 http://bbs.quyouji.com/topic.asp?id=1578 http://bbs.quyouji.com/topic.asp?id=1579 http://bbs.quyouji.com/topic.asp?id=1580 http://bbs.quyouji.com/topic.asp?id=1581 http://bbs.quyouji.com/topic.asp?id=1582 http://bbs.quyouji.com/topic.asp?id=1583 http://bbs.quyouji.com/topic.asp?id=1584 http://bbs.quyouji.com/topic.asp?id=1585 http://bbs.quyouji.com/topic.asp?id=1586 http://bbs.quyouji.com/topic.asp?id=1587 http://bbs.quyouji.com/topic.asp?id=1588 http://bbs.quyouji.com/topic.asp?id=1589 http://bbs.quyouji.com/topic.asp?id=1590 http://bbs.quyouji.com/topic.asp?id=1591 http://bbs.quyouji.com/topic.asp?id=1592 http://bbs.quyouji.com/topic.asp?id=1593 http://bbs.quyouji.com/topic.asp?id=1594 http://bbs.quyouji.com/topic.asp?id=1595 http://bbs.quyouji.com/topic.asp?id=1596 http://bbs.quyouji.com/topic.asp?id=1597 http://bbs.quyouji.com/topic.asp?id=1598 http://bbs.quyouji.com/topic.asp?id=1599 http://bbs.quyouji.com/topic.asp?id=1600 http://bbs.quyouji.com/topic.asp?id=1601 http://bbs.quyouji.com/topic.asp?id=1602 http://bbs.quyouji.com/topic.asp?id=1603 http://bbs.quyouji.com/topic.asp?id=1604 http://bbs.quyouji.com/topic.asp?id=1605 http://bbs.quyouji.com/topic.asp?id=1606 http://bbs.quyouji.com/topic.asp?id=1607 http://bbs.quyouji.com/topic.asp?id=1608 http://bbs.quyouji.com/topic.asp?id=1609 http://bbs.quyouji.com/topic.asp?id=1610 http://bbs.quyouji.com/topic.asp?id=1611 http://bbs.quyouji.com/topic.asp?id=1612 http://bbs.quyouji.com/topic.asp?id=1613 http://bbs.quyouji.com/topic.asp?id=1614 http://bbs.quyouji.com/topic.asp?id=1615 http://bbs.quyouji.com/topic.asp?id=1616 http://bbs.quyouji.com/topic.asp?id=1617 http://bbs.quyouji.com/topic.asp?id=1618 http://bbs.quyouji.com/topic.asp?id=1619 http://bbs.quyouji.com/topic.asp?id=1620 http://bbs.quyouji.com/topic.asp?id=1621 http://bbs.quyouji.com/topic.asp?id=1622 http://bbs.quyouji.com/topic.asp?id=1623 http://bbs.quyouji.com/topic.asp?id=1624 http://bbs.quyouji.com/topic.asp?id=1625 http://bbs.quyouji.com/topic.asp?id=1626 http://bbs.quyouji.com/topic.asp?id=1627 http://bbs.quyouji.com/topic.asp?id=1628 http://bbs.quyouji.com/topic.asp?id=1629 http://bbs.quyouji.com/topic.asp?id=1630 http://bbs.quyouji.com/topic.asp?id=1631 http://bbs.quyouji.com/topic.asp?id=1632 http://bbs.quyouji.com/topic.asp?id=1633 http://bbs.quyouji.com/topic.asp?id=1634 http://bbs.quyouji.com/topic.asp?id=1635 http://bbs.quyouji.com/topic.asp?id=1636 http://bbs.quyouji.com/topic.asp?id=1637 http://bbs.quyouji.com/topic.asp?id=1638
我们简单梳理下AnnotationAwareAspectJAutoProxyCreato类的核心继承关系,如下所示。
AnnotationAwareAspectJAutoProxyCreator –AspectJAwareAdvisorAutoProxyCreator –AbstractAdvisorAutoProxyCreator –AbstractAutoProxyCreator – ProxyProcessorSupport, SmartInstantiationAwareBeanPostProcessor 查看继承关系可以发现,此类实现了Aware与BeanPostProcessor接口,这两个接口都和Spring bean的初始化有关,由此推测此类主要处理方法都来自这两个接口的实现方法。同时该类也实现了order方法。
好了,二狗子说:有关AnnotationAwareAspectJAutoProxyCreator类的详细代码和执行流程我们后面再讲,他有点消化不了了。
重磅福利 关注「 冰河技术 」微信公众号,后台回复 “设计模式” 关键字领取《深入浅出Java 23种设计模式》PDF文档。回复“Java8”关键字领取《Java8新特性教程》PDF文档。回复“限流”关键字获取《亿级流量下的分布式限流解决方案》PDF文档,三本PDF均是由冰河原创并整理的超硬核教程,面试必备!!
好了,今天就聊到这儿吧!别忘了点个赞,给个在看和转发,让更多的人看到,一起学习,一起进步!!
写在最后