zoukankan      html  css  js  c++  java
  • [编程新手]Spring程序运行出错-基于XML的声明式Aspectj(aop,Unable to locate method [...] on bean [...])

    [报错信息]

    核心报错信息:

    Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userDao' defined in class path resource [com/ZhangWenhan/aspectj/xml/applicationContext.xml]: BeanPostProcessor before instantiation of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.aop.aspectj.AspectJPointcutAdvisor#3': Cannot create inner bean '(inner bean)#3ffcd140' of type [org.springframework.aop.aspectj.AspectJAfterThrowingAdvice] while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)#3ffcd140': Cannot create inner bean '(inner bean)#23bb8443' of type [org.springframework.aop.config.MethodLocatingFactoryBean] while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)#23bb8443': Initialization of bean failed; nested exception is java.lang.IllegalArgumentException: Unable to locate method [myAfterTrowing] on bean [myAspect]
    Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userDao' defined in class path resource [com/ZhangWenhan/aspectj/xml/applicationContext.xml]: BeanPostProcessor before instantiation of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.aop.aspectj.AspectJPointcutAdvisor#3': Cannot create inner bean '(inner bean)#3ffcd140' of type [org.springframework.aop.aspectj.AspectJAfterThrowingAdvice] while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)#3ffcd140': Cannot create inner bean '(inner bean)#23bb8443' of type [org.springframework.aop.config.MethodLocatingFactoryBean] while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)#23bb8443': Initialization of bean failed; nested exception is java.lang.IllegalArgumentException: Unable to locate method [myAfterTrowing] on bean [myAspect]

    [解决办法]

    查看错误信息:

    最后写着:unable locate method....

    在一份被引用的代码中,方法的名字被我写错了:(找不到方法??看看那个方法,方法在啊。方法写错了?方法写错了。)trowing 被我写成 throwing。如图。

    于是把throwing更改为trowing。

    再次运行,成功!

  • 相关阅读:
    对 Service中sqlsession对象的优化
    mybatis 接口绑定 和 动态SQL
    添加指定的日志信息
    数据库优化
    MyBatis 实现新增
    MyBatis中log4j 和 参数 和 分页和别名 功能
    OpenGL_混合
    android应用开发揭秘第13章01示例,移动图像,opengl绘制星星问题解决!
    《关于个人承接项目的注意事项》读后感
    Android OpenGL ES教程 第二部分 构建多边形
  • 原文地址:https://www.cnblogs.com/JuniorProgramer/p/12684276.html
Copyright © 2011-2022 走看看