import java.lang.reflect.Method;
import org.springframework.aop.MethodBeforeAdvice;
public class MethodBefore implements MethodBeforeAdvice {
public void before(Method method, Object[] objects, Object object)
throws Throwable {
System.out.println(method);
}
public static void main(String[] args) throws Throwable {
MethodBeforeAdvice advice = new MethodBefore();
Method[] methods =advice.getClass().getDeclaredMethods();
for (Method method : methods) {
advice.before(method, args, advice);
}
}
}
org.springframework.aop.MethodBeforeAdvice的简单实现
最新推荐文章于 2024-06-26 10:47:37 发布
本文介绍如何使用Java反射和Spring AOP实现前置通知,包括获取类中所有方法并调用前置通知方法。
442

被折叠的 条评论
为什么被折叠?



