<aop:config>
<aop:aspectref="magician">
<aop:pointcutid="thinking"
expression="execution(*
com.springinaction.springidol.Thinker.thinkOfSomething( String))
and args(thoughts)"/>
<aop:before
pointcut-ref="thinking"
method="interceptThoughts"
arg-names=" thoughts" />
</aop:aspect>
</aop:config>
The key to the Magician’s ESP is found in the pointcut definition and in the
<aop:before>’s arg-names attribute. The pointcut identifies the Thinker’s thinkOf-
Something() method, specifying a String argument. And it follows up with an args
parameter to identify the argument as thoughts.
Meanwhile, the <aop:before> advice declaration refers to the thoughts argument,
indicating that it should be passed into the Magician’s interceptThoughts()
method.
<aop:aspectref="magician">
<aop:pointcutid="thinking"
expression="execution(*
com.springinaction.springidol.Thinker.thinkOfSomething( String))
and args(thoughts)"/>
<aop:before
pointcut-ref="thinking"
method="interceptThoughts"
arg-names=" thoughts" />
</aop:aspect>
</aop:config>
The key to the Magician’s ESP is found in the pointcut definition and in the
<aop:before>’s arg-names attribute. The pointcut identifies the Thinker’s thinkOf-
Something() method, specifying a String argument. And it follows up with an args
parameter to identify the argument as thoughts.
Meanwhile, the <aop:before> advice declaration refers to the thoughts argument,
indicating that it should be passed into the Magician’s interceptThoughts()
method.