日期:2014-05-17 浏览次数:20938 次
package com.yyhy.java.search.compass; public interface Compassable { public String getContent(); }
package com.yyhy.java.search.compass; public class DefaultCompassableImpl implements Compassable { @Override public String getContent() { System.out.println("error aop"); return "error aop"; } }
package com.yyhy.java.search.compass; import org.aspectj.lang.JoinPoint; public aspect CompassAOP { declare parents: com.yyhy.java.GenericCoder.* extends DefaultCompassableImpl; declare parents: com.yyhy.java.Privilege.* extends DefaultCompassableImpl; declare parents: com.yyhy.hx.zcdfk.* extends DefaultCompassableImpl; declare parents: com.yyhy.hx.jgpmk.* extends DefaultCompassableImpl; declare parents: com.yyhy.log.* extends DefaultCompassableImpl; declare parents: com.yyhy.hx.zyqlk.* extends DefaultCompassableImpl; public pointcut compass():execution(* *.getContent(..)); Object around():compass(){ return thisJoinPoint.getThis().toString(); } }