先說(shuō)一下啟動(dòng)過(guò)程中的幾個(gè)點(diǎn):
加載配置文件:
AbstractAutowireCapableBeanFactory.doCreateBean --> initializeBean --> applyBeanPostProcessorsAfterInitialization --> beanProcessor.postProcessAfterInitialization --> AbstractAutoProxyCreator.postProcessAfterInitialization --> wrapIfNecessary(bean, beanName, cacheKey) --> getAdvicesAndAdvisorsForBean(bean.getClass(), beanName, null)Advisor是Pointcut和Advice的配置器,它包括Pointcut和Advice,是將Advice注入程序中Pointcut位置的代碼;AspectJProxyUtils.makeAdvisorChainAspectJCapableIfNecessary:調(diào)用txAdvice上圖的事務(wù)通知設(shè)置數(shù)據(jù)源 DataSourceTransactionManager,ChooseDataSource是項(xiàng)目中配置的自定義的繼承至AbstractRoutingDataSource的默認(rèn)數(shù)據(jù)源,命名什么的:
啟動(dòng)結(jié)束后,發(fā)起事務(wù)調(diào)用,首先攔截方法起CglibAopProxy.intercept --> ReflectiveMethodInvocation.proceed --> ExposeInvocationInterceptor.invoke --> TransactionInterceptor.invoke:
網(wǎng)友評(píng)論