源自:6-2 ProxyFactoryBean及相关内容(上)
为啥我的前置通知出现了好几次的?
<bean id="testBeforeAdvice" class="com.spirng.java.aop.service.api.TestBeforeAdvice"></bean>
<bean id="testAfterReturningAdvice" class="com.spirng.java.aop.service.api.TestAfterReturningAdvice"></bean>
<bean id="testThrowAdvice" class="com.spirng.java.aop.service.api.TestThrowAdvice"></bean>
<bean id="testMethodInterceptor" class="com.spirng.java.aop.service.api.TestMethodInterceptor"></bean>
<bean id="logServiceImplTarget" class="com.spirng.java.aop.service.api.impl.LogServiceImpl"></bean>
<bean id="pointcutBean" class="org.springframework.aop.support.NameMatchMethodPointcut">
<property name="mappedNames">
<list>
<value>ad*</value>
</list>
</property>
</bean>
<bean id="defaultAdvisor" class="org.springframework.aop.support.DefaultPointcutAdvisor">
<property name="advice" ref="testBeforeAdvice"></property>
<property name="pointcut" ref="pointcutBean"></property>
</bean>
<bean id="logServiceImpl" class="org.springframework.aop.framework.ProxyFactoryBean">
<property name="target" ref="logServiceImplTarget"></property>
<property name="interceptorNames" >
<list>
<value>testBeforeAdvice</value>
<value>testAfterReturningAdvice</value>
<value>testThrowAdvice</value>
<value>testMethodInterceptor</value>
</list>
</property>
</bean>
TestBeforeAdvice:com.sun.proxy.$Proxy14 add
TestBeforeAdvice:com.sun.proxy.$Proxy11 add
TestMethodInterceptor1:java.lang.reflect.Method add
TestBeforeAdvice:com.spirng.java.aop.service.api.impl.LogServiceImpl add
LogServiceImpl>>>>>>>>>>000000000
TestMethodInterceptor2:null
TestAfterReturningAdvice:com.sun.proxy.$Proxy11 add null
提问者:慕粉18755117234
2020-04-23 16:34