You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
webcrawler/web/src/main/java/web/aop/Advisor.java

27 lines
752 B

package web.aop;
import org.aopalliance.aop.Advice;
import org.springframework.aop.support.StaticMethodMatcherPointcutAdvisor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.util.ClassUtils;
import web.service.BaseService;
import java.lang.reflect.Method;
/**
* Created by reborn on 2017/8/3.
*/
@Component
public class Advisor extends StaticMethodMatcherPointcutAdvisor {
@Autowired
public Advisor(Advice advice) {
super(advice);
}
@Override
public boolean matches(Method method, Class<?> aClass) {
return BaseService.class.isAssignableFrom(ClassUtils.getUserClass(aClass))&&method.getName().equals("save");
}
}