package com.sf.aop.advisor; import org.springframework.aop.MethodMatcher; import java.lang.reflect.Method; // 类过滤之后 还要进行方法的匹配 // aop的接口 MethodMatcher public class EatMethodMatcher implements MethodMatcher { // 实现方法的匹配逻辑 @Override public boolean matches(Method method, Class targetClass) { if(method.getName().equals("eat")){ // 对方法的匹配验证 return true; } return false; } @Override public boolean isRuntime() { return false; } @Override public boolean matches(Method method, Class targetClass, Object... args) { return false; } }