<bean id="clientService"
class="usertest.service.impl.UserClientService">
</bean>
class="usertest.test.ClientServiceInterceptor">
</bean>
<bean id="postInterceptor"
class="org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator">
<property name="beanNames">
<list>
<value>clientService</value>
</list>
</property>
<property name="interceptorNames">
<list>
<value>postAdvisor</value>
</list>
</property>
</bean>
<bean id="postAdvisor"
class="org.springframework.aop.support.NameMatchMethodPointcutAdvisor">
<property name="advice">
<ref local="clientAfterReturingAdvice" />
</property>
<property name="mappedNames">
<list>
<value>getOneClient</value>
</list>
</property>
class="usertest.service.impl.UserClientService">
</bean>
//advice 切面,实现AfterReturningAdvice接口
<bean id="clientAfterReturingAdvice"class="usertest.test.ClientServiceInterceptor">
</bean>
<bean id="postInterceptor"
class="org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator">
<property name="beanNames">
<list>
<value>clientService</value>
</list>
</property>
<property name="interceptorNames">
<list>
<value>postAdvisor</value>
</list>
</property>
</bean>
<bean id="postAdvisor"
class="org.springframework.aop.support.NameMatchMethodPointcutAdvisor">
<property name="advice">
<ref local="clientAfterReturingAdvice" />
</property>
<property name="mappedNames">
<list>
<value>getOneClient</value>
</list>
</property>
</bean>
在AfterReturningAdvice中,不能修改retValue的指向的引用,修改了也不起作用,但可以设置retValue对象里面字段的值