The following issues were encountered when practicing spring's post-enhancement:
Org.springframework.beans.factory.BeanCreationException:Error creating Bean with Name ' ItemAction2 ' defined in class Path resource [Applicationcontext.xml]: Beanpostprocessor before instantiation of Bean failed; Nested exception is org.springframework.beans.factory.BeanCreationException:Error creating beans with Name ' Org.springframework.aop.aspectj.aspectjpointcutadvisor#1 ': Instantiation of Bean failed; Nested exception is org.springframework.beans.BeanInstantiationException:Could not instantiate Bean class [ Org.springframework.aop.aspectj.AspectJPointcutAdvisor]: Constructor threw exception; Nested exception is java.lang.IllegalArgumentException:error at:: 0 formal Unbound in pointcut
At Org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean ( abstractautowirecapablebeanfactory.java:457)
At Org.springframework.beans.factory.support.abstractbeanfactory$1.getobject (abstractbeanfactory.java:295)
At Org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton ( defaultsingletonbeanregistry.java:223)
At Org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean (abstractbeanfactory.java:292)
At Org.springframework.beans.factory.support.AbstractBeanFactory.getBean (abstractbeanfactory.java:194)
At Org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons ( defaultlistablebeanfactory.java:607)
At Org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization ( abstractapplicationcontext.java:932)
At Org.springframework.context.support.AbstractApplicationContext.refresh (abstractapplicationcontext.java:479)
At Org.springframework.context.support.classpathxmlapplicationcontext.<init> ( classpathxmlapplicationcontext.java:139)
At Org.springframework.context.support.classpathxmlapplicationcontext.<init> ( CLASSPATHXMLAPPLICATIONCONTEXT.JAVA:83)
At Cn.itcast.test.TestAdvice.test5 (testadvice.java:90)
At Sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
At Sun.reflect.NativeMethodAccessorImpl.invoke (nativemethodaccessorimpl.java:57)
At Sun.reflect.DelegatingMethodAccessorImpl.invoke (delegatingmethodaccessorimpl.java:43)
At Java.lang.reflect.Method.invoke (method.java:606)
At Org.junit.runners.model.frameworkmethod$1.runreflectivecall (frameworkmethod.java:44)
At Org.junit.internal.runners.model.ReflectiveCallable.run (reflectivecallable.java:15)
At org.junit.runners.model.FrameworkMethod.invokeExplosively (frameworkmethod.java:41)
At Org.junit.internal.runners.statements.InvokeMethod.evaluate (invokemethod.java:20)
At Org.junit.runners.ParentRunner.runLeaf (parentrunner.java:263)
At Org.junit.runners.BlockJUnit4ClassRunner.runChild (blockjunit4classrunner.java:69)
At Org.junit.runners.BlockJUnit4ClassRunner.runChild (blockjunit4classrunner.java:48)
At Org.junit.runners.parentrunner$3.run (parentrunner.java:231)
At Org.junit.runners.parentrunner$1.schedule (parentrunner.java:60)
At Org.junit.runners.ParentRunner.runChildren (parentrunner.java:229)
At org.junit.runners.parentrunner.access$000 (parentrunner.java:50)
At Org.junit.runners.parentrunner$2.evaluate (parentrunner.java:222)
At Org.junit.runners.ParentRunner.run (parentrunner.java:292)
At Org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run (junit4testreference.java:50)
At Org.eclipse.jdt.internal.junit.runner.TestExecution.run (testexecution.java:38)
At Org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests (remotetestrunner.java:467)
At Org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests (remotetestrunner.java:683)
At Org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run (remotetestrunner.java:390)
At Org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main (remotetestrunner.java:197)
caused by:org.springframework.beans.factory.BeanCreationException:Error creating bean with Name ' Org.springframework.aop.aspectj.aspectjpointcutadvisor#1 ': Instantiation of Bean failed; Nested exception is org.springframework.beans.BeanInstantiationException:Could not instantiate Bean class [ Org.springframework.aop.aspectj.AspectJPointcutAdvisor]: Constructor threw exception; Nested exception is java.lang.IllegalArgumentException:error at:: 0 formal Unbound in pointcut
At Org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor (Constructorresolver.java : 288)
At Org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor ( abstractautowirecapablebeanfactory.java:1049)
At Org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance ( abstractautowirecapablebeanfactory.java:953)
At Org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean ( abstractautowirecapablebeanfactory.java:490)
At Org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean ( abstractautowirecapablebeanfactory.java:461)
At Org.springframework.beans.factory.support.abstractbeanfactory$1.getobject (abstractbeanfactory.java:295)
At Org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton ( defaultsingletonbeanregistry.java:223)
At Org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean (abstractbeanfactory.java:292)
At Org.springframework.beans.factory.support.AbstractBeanFactory.getBean (abstractbeanfactory.java:198)
At Org.springframework.aop.framework.autoproxy.BeanFactoryAdvisorRetrievalHelper.findAdvisorBeans ( BEANFACTORYADVISORRETRIEVALHELPER.JAVA:86)
At Org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator.findCandidateAdvisors ( ABSTRACTADVISORAUTOPROXYCREATOR.JAVA:100)
At Org.springframework.aop.aspectj.autoproxy.AspectJAwareAdvisorAutoProxyCreator.shouldSkip ( aspectjawareadvisorautoproxycreator.java:107)
At Org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.postProcessBeforeInstantiation ( abstractautoproxycreator.java:275)
At Org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInstantiation (abstractautowirecapablebeanfactory.java:894)
At Org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.resolveBeforeInstantiation ( abstractautowirecapablebeanfactory.java:866)
At Org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean ( abstractautowirecapablebeanfactory.java:451)
... More
caused by:org.springframework.beans.BeanInstantiationException:Could not instantiate Bean class [ Org.springframework.aop.aspectj.AspectJPointcutAdvisor]: Constructor threw exception; Nested exception is java.lang.IllegalArgumentException:error at:: 0 formal Unbound in pointcut
At Org.springframework.beans.BeanUtils.instantiateClass (beanutils.java:163)
At Org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate ( simpleinstantiationstrategy.java:121)
At Org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor (Constructorresolver.java : 280)
... More
Caused by:java.lang.IllegalArgumentException:error at:: 0 formal Unbound in pointcut
At Org.aspectj.weaver.tools.PointcutParser.parsePointcutExpression (pointcutparser.java:302)
At Org.springframework.aop.aspectj.AspectJExpressionPointcut.buildPointcutExpression ( aspectjexpressionpointcut.java:207)
At Org.springframework.aop.aspectj.AspectJExpressionPointcut.buildPointcutExpression ( aspectjexpressionpointcut.java:193)
At Org.springframework.aop.aspectj.AspectJExpressionPointcut.checkReadyToMatch (Aspectjexpressionpointcut.java : 182)
At Org.springframework.aop.aspectj.AspectJExpressionPointcut.getMethodMatcher (Aspectjexpressionpointcut.java : 168)
At Org.springframework.aop.aspectj.AbstractAspectJAdvice.buildSafePointcut (abstractaspectjadvice.java:187)
At Org.springframework.aop.aspectj.aspectjpointcutadvisor.<init> (aspectjpointcutadvisor.java:51)
At Sun.reflect.NativeConstructorAccessorImpl.newInstance0 (Native Method)
At Sun.reflect.NativeConstructorAccessorImpl.newInstance (nativeconstructoraccessorimpl.java:57)
At Sun.reflect.DelegatingConstructorAccessorImpl.newInstance (delegatingconstructoraccessorimpl.java:45)
At Java.lang.reflect.Constructor.newInstance (constructor.java:526)
At Org.springframework.beans.BeanUtils.instantiateClass (beanutils.java:148)
... More
The view is due to an issue with the enhanced code:
public void afterrunning (Joinpoint joinpoint,object returnvalue) {
System.out.println ("After running ....");
}
The Joinpoint class should be org.aspectj.lang.JoinPoint, but I mistakenly introduced the Org.aopalliance.intercept.Joinpoint package, which led to the
Could not instantiate Bean class [org.springframework.aop.aspectj.AspectJPointcutAdvisor]: Constructor threw exception ; Nested exception is java.lang.IllegalArgumentException:error at:: 0 formal Unbound in pointcut
Spring exception-aoperror at:0 formal unbound in pointcut