1.定义接口Perform
package com.show; /** * Created by kenneth on 2017/4/6. */ public interface Perform { void sing(); }2.定义接口Perform的实现类Boy
package com.show; /** * Created by kenneth on 2017/4/6. */ public class Boy implements Perform { @Override public void sing() { System.out.println("男孩在唱歌"); } }
3.定义通知PerformHelper
package com.show; import org.springframework.aop.AfterReturningAdvice; import org.springframework.aop.MethodBeforeAdvice; import java.lang.reflect.Method; /** * Created by kenneth on 2017/4/6. */ public class PerformHelper implements MethodBeforeAdvice