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-&gtAddExternalJars:
Spring AOP应用运行时异常的一个解决方案
文章图片

将这三个jar加到BuildPath里:
错误消失:
Spring AOP应用运行时异常的一个解决方案
文章图片

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

aspectjweaver.jar:TheAspectJweaverintroducesadvicestojavaclasses , 给Java类引入对advices的支持
下载地址:https://mvnrepository.com/artifact/org.aspectj/aspectjweaver
aopalliance.jar:TheAOPAllianceaimstoensureinteroperabilitybetweenJava/J2EEAOPimplementationstobuildalargerAOPcommunity.
下载地址:https://sourceforge.net/projects/aopalliance/
Spring AOP应用运行时异常的一个解决方案
文章图片

【来源:汪子熙的游泳故事】
声明:转载此文是出于传递更多信息之目的 。 若有来源标注错误或侵犯了您的合法权益 , 请作者持权属证明与本网联系 , 我们将及时更正、删除 , 谢谢 。 邮箱地址:newmedia@xxcb.cn


    推荐阅读