定义参数,可以注入预期值,延迟,sleep等
注入的代码,以注入预期对象为例,其他(sleep,exception)雷同省略
<bean
id="mockAspect"
class="com.taobao.azeroth.util.MockTestAspect" >
<property name="sleepTime" value="0"/>
<property name="flag" value="false"/>
</bean>
<aop:config proxy-target-class="false" >
<aop:pointcut
id="springTestPointcut"
expression="execution(* com..Hello.hello(..))" />
<aop:aspect
id="aspectSpringSleep"
ref="mockAspect" order="100">
<aop:around
method="mockMethod"
pointcut-ref="springTestPointcut" />
原文转自:http://www.taobaotesting.com/blogs/2443