前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >Spring AOP异常:Error creating bean with name ‘org.springframework.aop.aspectj.

Spring AOP异常:Error creating bean with name ‘org.springframework.aop.aspectj.

作者头像
Jerry Wang
发布2020-07-27 17:14:40
1.5K0
发布2020-07-27 17:14:40
举报

异常:

代码语言:javascript
复制
Jul 26, 2020 11:43:22 AM org.springframework.context.support.ClassPathXmlApplicationContext prepareRefresh
INFO: Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@4ee285c6: startup date [Sun Jul 26 11:43:22 CST 2020]; root of context hierarchy
Jul 26, 2020 11:43:22 AM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from class path resource [Beans.xml]
Jul 26, 2020 11:43:23 AM org.springframework.context.support.ClassPathXmlApplicationContext refresh
WARNING: Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.aop.aspectj.AspectJPointcutAdvisor#0': Cannot create inner bean '(inner bean)#4493d195' of type [org.springframework.aop.aspectj.AspectJMethodBeforeAdvice] while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)#4493d195': Cannot resolve reference to bean 'selectAll' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'selectAll': Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.aop.aspectj.AspectJExpressionPointcut]: No default constructor found; nested exception is java.lang.NoClassDefFoundError: org/aspectj/weaver/reflect/ReflectionWorld$ReflectionWorldException
Jerry ends here!

解决方案

右键单击项目,选择Configure build path->Add External Jars:

将这三个jar加到Build Path里:

错误消失:

aspectjrt.jar:The runtime needed to execute a program using AspectJ. 基于AspectJ库的应用运行时必须的运行库。

下载地址:https://mvnrepository.com/artifact/org.aspectj/aspectjrt/1.6.9

aspectjweaver.jar: The AspectJ weaver introduces advices to java classes,给Java类引入对advices的支持

下载地址:https://mvnrepository.com/artifact/org.aspectj/aspectjweaver

aopalliance.jar: The AOP Alliance aims to ensure interoperability between Java/J2EE AOP implementations to build a larger AOP community.

下载地址:https://sourceforge.net/projects/aopalliance/

本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2020-07-26 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 解决方案
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档