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.
30 lines
761 B
30 lines
761 B
package core.aop;
|
|
|
|
import core.dao.BaseDao1;
|
|
import core.dao.BaseDao2;
|
|
import org.aopalliance.aop.Advice;
|
|
import org.springframework.aop.support.StaticMethodMatcherPointcutAdvisor;
|
|
import org.springframework.stereotype.Component;
|
|
|
|
import javax.annotation.PostConstruct;
|
|
import javax.annotation.Resource;
|
|
import java.lang.reflect.Method;
|
|
|
|
/**
|
|
* Created by reborn on 2017/8/3.
|
|
*/
|
|
@Component
|
|
public class Advisor extends StaticMethodMatcherPointcutAdvisor {
|
|
@Resource
|
|
private Advice advice;
|
|
|
|
@Override
|
|
public boolean matches(Method method, Class<?> aClass) {
|
|
return BaseDao1.class.isAssignableFrom(aClass)||BaseDao2.class.isAssignableFrom(aClass);
|
|
}
|
|
|
|
@PostConstruct
|
|
public void init(){
|
|
this.setAdvice(advice);
|
|
}
|
|
}
|
|
|