mvc-config.xml:
<!-- AOP配置管理员身份认证增强 -->
<bean id="validateAspect" class="com.ss.demo.advice.ValidateBeforeAdvice" />
<aop:config proxy-target-class="true">
<aop:pointcut id="validatePointcut"
expression="execution(* com.ss.demo.web.AdminController.*(..))" />
<aop:aspect ref="validateAspect">
<aop:before pointcut-ref="validatePointcut" method="validate" />
</aop:aspect>
</aop:config>
Aspect:
package com.ss.demo.advice;
public class ValidateBeforeAdvice {
public void validate() {
System.out.println("AOP Test");
}
}
根异常:
Caused by: java.lang.IllegalArgumentException: Unable to locate method [validate] on bean [validateAspect]
不知道为什么还是Unable to locate ,检查过拼写了。
------解决思路----------------------
你把切入点放在切面里边试试