Spring AOP应用运行时异常的一个解决方案
异常:
Jul26,202011:43:22AMorg.springframework.context.support.ClassPathXmlApplicationContextprepareRefreshINFO:Refreshingorg.springframework.context.support.ClassPathXmlApplicationContext@4ee285c6:startupdate[SunJul2611:43:22CST2020]rootofcontexthierarchyJul26,202011:43:22AMorg.springframework.beans.factory.xml.XmlBeanDefinitionReaderloadBeanDefinitionsINFO:LoadingXMLbeandefinitionsfromclasspathresource[Beans.xml]Jul26,202011:43:23AMorg.springframework.context.support.ClassPathXmlApplicationContextrefreshWARNING:Exceptionencounteredduringcontextinitialization-cancellingrefreshattempt:org.springframework.beans.factory.BeanCreationException:Errorcreatingbeanwithname"org.springframework.aop.aspectj.AspectJPointcutAdvisor#0":Cannotcreateinnerbean"(innerbean)#4493d195"oftype[org.springframework.aop.aspectj.AspectJMethodBeforeAdvice]whilesettingconstructorargumentnestedexceptionisorg.springframework.beans.factory.BeanCreationException:Errorcreatingbeanwithname"(innerbean)#4493d195":Cannotresolvereferencetobean"selectAll"whilesettingconstructorargumentnestedexceptionisorg.springframework.beans.factory.BeanCreationException:Errorcreatingbeanwithname"selectAll":Instantiationofbeanfailednestedexceptionisorg.springframework.beans.BeanInstantiationException:Failedtoinstantiate[org.springframework.aop.aspectj.AspectJExpressionPointcut]:Nodefaultconstructorfoundnestedexceptionisjava.lang.NoClassDefFoundError:org/aspectj/weaver/reflect/ReflectionWorld$ReflectionWorldExceptionJerryendshere!
#解决方案右键单击项目 , 选择Configurebuildpath->AddExternalJars:

文章图片
将这三个jar加到BuildPath里:
错误消失:

文章图片
aspectjrt.jar:TheruntimeneededtoexecuteaprogramusingAspectJ.基于AspectJ库的应用运行时必须的运行库 。
【Spring AOP应用运行时异常的一个解决方案】下载地址:https://mvnrepository.com/artifact/org.aspectj/aspectjrt/1.6.9

文章图片
aspectjweaver.jar:TheAspectJweaverintroducesadvicestojavaclasses , 给Java类引入对advices的支持
下载地址:https://mvnrepository.com/artifact/org.aspectj/aspectjweaver
aopalliance.jar:TheAOPAllianceaimstoensureinteroperabilitybetweenJava/J2EEAOPimplementationstobuildalargerAOPcommunity.
下载地址:https://sourceforge.net/projects/aopalliance/

文章图片
【来源:汪子熙的游泳故事】
声明:转载此文是出于传递更多信息之目的 。 若有来源标注错误或侵犯了您的合法权益 , 请作者持权属证明与本网联系 , 我们将及时更正、删除 , 谢谢 。 邮箱地址:newmedia@xxcb.cn
推荐阅读
- spring框架之注解的使用
- 量子物理学|量子物理学的重要应用,与普通计算机结构完全不同,还需继续探索
- 精神药品|重磅!银河麒麟操作系统V10发布 支持海量安卓应用
- iOS的TestFlight应用获得新图标 更加立体与写实
- 行业互联网|妈湾智慧港落地:深圳点亮5G港口应用前进之路
- IOS系统|iOS的TestFlight应用获得新图标 更加立体与写实
- 玩转MT4之模板应用
- |先声药业创新药恩瑞舒在中国上市,广泛的临床应用成研究重点
- 应用|众趣科技:起于体感游戏的火花,如何让三维实景成为一个大生意?
- 华为|“华为应用市场AppGallery Connect沙龙”新亮点,你get到了吗?
