nested exception is java.lang.IllegalArgumentException: Pointcut is not well-formed

时间:2023-03-09 04:48:35
nested exception is java.lang.IllegalArgumentException: Pointcut is not well-formed

在用AOP 的时候出现了如下的错误,

警告: Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'atrthmeticCalculatorImpl' defined in file [D:\workspaceSpring\SpringAOP\bin\com\myth\spring\aop\impl\AtrthmeticCalculatorImpl.class]: Initialization of bean failed; nested exception is java.lang.IllegalArgumentException: Pointcut is not well-formed: expecting ')' at character position 70
execution(int com.myth.spring.aop.impl.AtrthmeticCalculatorImpl.*(int i,..))

这个是因为前置或者后置的 execution(int com.myth.spring.aop.impl.AtrthmeticCalculatorImpl.*(int i,..)参数没写对导致的

改成如下格式就好了  可以用*通配@After("execution(int com.myth.spring.aop.impl.AtrthmeticCalculatorImpl.*(int , int))")