error at ::0 formal unbound in pointcut 报错
来源:互联网 发布:ubuntu方德软件中心 编辑:程序博客网 时间:2024/05/16 05:40
以下是错误代码:
Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'atithmeticCalculatorImpl' defined in file [D:\EclipseWorkspace\spring-2\bin\com\ltj\spring\aop\impl\AtithmeticCalculatorImpl.class]: Initialization of bean failed; nested exception is java.lang.IllegalArgumentException: error at ::0 formal unbound in pointcut
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:547)at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:475)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:304)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:300)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:195)
以下是的切面中的代码:
@Aspect
@Component
public class LogginAspect {
/**
* 定义一个方法,用于声明切面表达式,一般地,该方法中不再需要添加其他的代码
*
*/
@Pointcut("execution(public int com.ltj.spring.aop.impl.AtithmeticCalculatorImpl.*(..))")
public void declareJoinPointExpression() {
}
@Before("declareJoinPointExpression()")
public void beforeMethed(JoinPoint joinPoint) {
String methedName = joinPoint.getSignature().getName();
List<Object> args = Arrays.asList(joinPoint.getArgs());
System.out.println("The methed " + methedName + " begins with " + args);
}
@After("declareJoinPointExpression()")
public void afterMethed(JoinPoint joinPoint) {
String methedName = joinPoint.getSignature().getName();
System.out.println("The methed " + methedName + " ends");
}
@AfterReturning(value = "declareJoinPointExpression()")
public void afterReturning(JoinPoint joinPoint, Object result) {
String methedName = joinPoint.getSignature().getName();
System.out.println("The methed " + methedName + " ends with " + result);
}
最后发现这里有问题,把它改为以下就没有问题了
@AfterReturning(value = "declareJoinPointExpression()", returning = "result")//这行里少了returning = "result"这个参数,加上就可以以了
public void afterReturning(JoinPoint joinPoint, Object result) {
String methedName = joinPoint.getSignature().getName();
System.out.println("The methed " + methedName + " ends with " + result);
}
@AfterThrowing(value = "declareJoinPointExpression()", throwing = "ex")
public void afterThrowin(JoinPoint joinPoint, Exception ex) {
String methedName = joinPoint.getSignature().getName();
System.out.println("The methed " + methedName + "eccurs exception "
+ ex);
}
- error at ::0 formal unbound in pointcut 报错
- error at ::0 formal unbound in pointcut
- spring4 aop 带参数表达式报错 error at ::0 formal unbound in pointcut
- 引入AOP 报错 error at ::0 formal unbound in pointcut
- Spring AOP 错误error at ::0 formal unbound in pointcut
- spring aop xml------error at ::0 formal unbound in pointcut
- SpringAOP配置声明式切面时报错error at ::0 formal unbound in pointcut
- error at ::0 formal unbound in pointcut 以及 error at ::0 can't find referenced pointcut myMethod
- Spring错误:Pointcut is malformed: error at ::0 formal unbound...
- nested exception is java.lang. IllegalArgumentException: error at ::0 formal unbound in pointcut
- spring aop学习中遇到的问题——error at ::0 formal unbound in pointcut
- AOP异常: java.lang.IllegalArgumentException: error at ::0 formal unbound in pointcut 1
- 0 formal unbound in pointcut(Spring AOP)
- error Type referred to is not an annotation type: validate 0 formal unbound in pointcut
- Spring: aop自动标注时出现 “0 formal unbound in pointcut"
- Spring AspectJ报错:error at ::0 can't find referenced pointcut XXX
- Spring中BeanCreationException异常::0formul unbound in pointcut
- 【Spring实战】—— 12 AspectJ报错:error at ::0 can't find referenced pointcut XXX
- oracle
- strtok、strtok_s、strtok_r 字符串分割函数
- java 学习进阶
- Android 基础 notification 简单应用
- oracle
- error at ::0 formal unbound in pointcut 报错
- 竞价拍卖理论的介绍(RTB模型中使用第二竞价模型,为的是纳什平衡,保护所有多方利益)
- Oracle 分区表
- 2014西安区域赛总结
- 关于学习html,CSS,javascript的感想
- oracle
- C# WinForm窗体的TopMost属性设置为true时,多次点击窗体弹出事件,只会弹出一个窗体
- Servlet Cookies 处理
- hdoj_2191_多重背包