在这里分享一下本人在学习spring AOP是遇到的问题,及处理过程。
在编写前置通知时会出现The hierarchy of the type MyMethodBeforeAdvice is inconsistent的异常,
package com.spring.aop;
import java.lang.reflect.Method;
import org.springframework.aop.MethodBeforeAdvice;
public class MyMethodBeforeAdvice implements MethodBeforeAdvice {
@Override
public void before(Method arg0, Object[] arg1, Object arg2)
throws Throwable {
// TODO Auto-generated method stub
System.out.println("...前置通知 "+arg0.getName());
}
}
最后的处理是,有一个包没有引用,该包是aopalliance-1.0.jar。引入后问题解决