Spring面向切面编程详解(5)

<aop:config> <aop:aspect ref="trackCounter"> <aop:pointcut id="trackPlayed" expression="execution(* com.service.CompactDisc.playTrack(int)) and args(trackNumber)"/> <aop:before method="countTrack" pointcut-ref="trackPlayed"/> </aop:aspect> </aop:config>

View Code

5、注入新功能

<aop:config> <aop:aspect> <aop:declare-parents types-matching="com.service.CompactDisc+" implement-interface="com.service.Encoreable" default-impl="com.service.impl.DefaultEncoreable" delegate-ref="encoreableDelegate"/> </aop:aspect> </aop:config> 

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/9876fa0a01bbd57ccb32933e97052e8d.html