<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>