AOP底层是如何判断哪些方法被代理了
洛翼轻尘 2015-12-27 09:58:32 如下代码:Spring容器启动完成后,是怎么知道* com.spring.service.*.*(..)的中的方法被执行了的?
个人理解是Spring容器在启动时将* com.spring.service.*.*(..)下的方法都存在一个map里面,每当执行一个方法的时候都到这个map里面匹配一下看是否需要代理,不知带这样理解对不对??
<aop:config>
<aop:aspect id="TestAspect" ref="aspectBean">
<!--配置com.spring.service包下所有类或接口的所有方法-->
<aop:pointcut id="businessService" expression="execution(* com.spring.service.*.*(..))" />
<aop:before pointcut-ref="businessService" method="doBefore"/>
<aop:after pointcut-ref="businessService" method="doAfter"/>
<aop:around pointcut-ref="businessService" method="doAround"/>
<aop:after-throwing pointcut-ref="businessService" method="doThrowing" throwing="ex"/>
</aop:aspect>
</aop:config>
<bean id="aspectBean" class="com.spring.aop.TestAspect" />
<bean id="aService" class="com.spring.service.AServiceImpl"></bean>
<bean id="bService" class="com.spring.service.BServiceImpl"></bean>