我的方面是:@Aspect@Servicepublic class MyAspect { @AfterReturning(value="(execution(* find(..)) )" + "&& target(com.erp.core.service.IBaseApplicationService) " + "&& args(queryKey,object,..)") public void print() { System.out.println("find method called"); }}AOP 找不到的类型名称在:@Transactional(readOnly=true)public List find(String queryKey, Object[] object) { return baseRepository.find(queryKey, object);}find 是基本方法,所以每当我打开一个页面时,它都会被调用。堆栈跟踪如下: Caused by: java.lang.IllegalArgumentException: warning no match for this type name: queryKey [Xlint:invalidAbsoluteTypeName] at org.aspectj.weaver.tools.PointcutParser.parsePointcutExpression(PointcutParser.java:301) at org.springframework.aop.aspectj.AspectJExpressionPointcut.buildPointcutExpression(AspectJExpressionPointcut.java:195) at org.springframework.aop.aspectj.AspectJExpressionPointcut.checkReadyToMatch(AspectJExpressionPointcut.java:181) at org.springframework.aop.aspectj.AspectJExpressionPointcut.getClassFilter(AspectJExpressionPointcut.java:162) at org.springframework.aop.support.AopUtils.canApply(AopUtils.java:200) at org.springframework.aop.support.AopUtils.canApply(AopUtils.java:254) at org.springframework.aop.support.AopUtils.findAdvisorsThatCanApply(AopUtils.java:286)它表明与类型名称 queryKey 不匹配
1 回答
月关宝盒
TA贡献1772条经验 获得超5个赞
在绑定形式中使用 args 时,需要在方法通知中包含要绑定的参数。
注意下面的方法声明
编辑
@AfterReturning(value="(execution(* find(..)) )" +
"&& target(com.erp.core.service.IBaseApplicationService) " +
"&& args(queryKey,object,..)",returning="returnList")
public void **print(String queryKey, Object[] object,List returnList)**
{
System.out.println("find method called");
}
添加回答
举报
0/150
提交
取消