@EnableAspectJAutoProxy:java.lang.NoClassDefFoundError: org/aspectj/lang/annotation/Pointcut

@EnableAspectJAutoProxy注解版本不兼容出现的异常
org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘org.springframework.aop.config.internalAutoProxyCreator’: Initialization of bean failed; nested exception is java.lang.NoClassDefFoundError: org/aspectj/lang/annotation/Pointcut
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:584)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:498)
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:204)
at org.springframework.context.support.PostProcessorRegistrationDelegate.registerBeanPostProcessors(PostProcessorRegistrationDelegate.java:228)
at org.springframework.context.support.AbstractApplicationContext.registerBeanPostProcessors(AbstractApplicationContext.java:707)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:531)
at org.springframework.context.annotation.AnnotationConfigApplicationContext.(AnnotationConfigApplicationContext.java:88)
at com.xc.annotation.test.IOCTest_AOP.test(IOCTest_AOP.java:15)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner 2. e v a l u a t e ( P a r e n t R u n n e r . j a v a : 268 ) a t o r g . j u n i t . r u n n e r s . P a r e n t R u n n e r . r u n ( P a r e n t R u n n e r . j a v a : 363 ) a t o r g . e c l i p s e . j d t . i n t e r n a l . j u n i t 4. r u n n e r . J U n i t 4 T e s t R e f e r e n c e . r u n ( J U n i t 4 T e s t R e f e r e n c e . j a v a : 86 ) a t o r g . e c l i p s e . j d t . i n t e r n a l . j u n i t . r u n n e r . T e s t E x e c u t i o n . r u n ( T e s t E x e c u t i o n . j a v a : 38 ) a t o r g . e c l i p s e . j d t . i n t e r n a l . j u n i t . r u n n e r . R e m o t e T e s t R u n n e r . r u n T e s t s ( R e m o t e T e s t R u n n e r . j a v a : 538 ) a t o r g . e c l i p s e . j d t . i n t e r n a l . j u n i t . r u n n e r . R e m o t e T e s t R u n n e r . r u n T e s t s ( R e m o t e T e s t R u n n e r . j a v a : 760 ) a t o r g . e c l i p s e . j d t . i n t e r n a l . j u n i t . r u n n e r . R e m o t e T e s t R u n n e r . r u n ( R e m o t e T e s t R u n n e r . j a v a : 460 ) a t o r g . e c l i p s e . j d t . i n t e r n a l . j u n i t . r u n n e r . R e m o t e T e s t R u n n e r . m a i n ( R e m o t e T e s t R u n n e r . j a v a : 206 ) C a u s e d b y : j a v a . l a n g . N o C l a s s D e f F o u n d E r r o r : o r g / a s p e c t j / l a n g / a n n o t a t i o n / P o i n t c u t a t o r g . s p r i n g f r a m e w o r k . a o p . a s p e c t j . a n n o t a t i o n . A b s t r a c t A s p e c t J A d v i s o r F a c t o r y . < c l i n i t > ( A b s t r a c t A s p e c t J A d v i s o r F a c t o r y . j a v a : 62 ) a t o r g . s p r i n g f r a m e w o r k . a o p . a s p e c t j . a n n o t a t i o n . A n n o t a t i o n A w a r e A s p e c t J A u t o P r o x y C r e a t o r . i n i t B e a n F a c t o r y ( A n n o t a t i o n A w a r e A s p e c t J A u t o P r o x y C r e a t o r . j a v a : 82 ) a t o r g . s p r i n g f r a m e w o r k . a o p . f r a m e w o r k . a u t o p r o x y . A b s t r a c t A d v i s o r A u t o P r o x y C r e a t o r . s e t B e a n F a c t o r y ( A b s t r a c t A d v i s o r A u t o P r o x y C r e a t o r . j a v a : 63 ) a t o r g . s p r i n g f r a m e w o r k . b e a n s . f a c t o r y . s u p p o r t . A b s t r a c t A u t o w i r e C a p a b l e B e a n F a c t o r y . i n v o k e A w a r e M e t h o d s ( A b s t r a c t A u t o w i r e C a p a b l e B e a n F a c t o r y . j a v a : 1767 ) a t o r g . s p r i n g f r a m e w o r k . b e a n s . f a c t o r y . s u p p o r t . A b s t r a c t A u t o w i r e C a p a b l e B e a n F a c t o r y . i n i t i a l i z e B e a n ( A b s t r a c t A u t o w i r e C a p a b l e B e a n F a c t o r y . j a v a : 1732 ) a t o r g . s p r i n g f r a m e w o r k . b e a n s . f a c t o r y . s u p p o r t . A b s t r a c t A u t o w i r e C a p a b l e B e a n F a c t o r y . d o C r e a t e B e a n ( A b s t r a c t A u t o w i r e C a p a b l e B e a n F a c t o r y . j a v a : 576 ) . . . 33 m o r e C a u s e d b y : j a v a . l a n g . C l a s s N o t F o u n d E x c e p t i o n : o r g . a s p e c t j . l a n g . a n n o t a t i o n . P o i n t c u t a t j a v a . n e t . U R L C l a s s L o a d e r . f i n d C l a s s ( U R L C l a s s L o a d e r . j a v a : 381 ) a t j a v a . l a n g . C l a s s L o a d e r . l o a d C l a s s ( C l a s s L o a d e r . j a v a : 424 ) a t s u n . m i s c . L a u n c h e r 2.evaluate(ParentRunner.java:268) at org.junit.runners.ParentRunner.run(ParentRunner.java:363) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:538) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:760) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:460) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:206) Caused by: java.lang.NoClassDefFoundError: org/aspectj/lang/annotation/Pointcut at org.springframework.aop.aspectj.annotation.AbstractAspectJAdvisorFactory.<clinit>(AbstractAspectJAdvisorFactory.java:62) at org.springframework.aop.aspectj.annotation.AnnotationAwareAspectJAutoProxyCreator.initBeanFactory(AnnotationAwareAspectJAutoProxyCreator.java:82) at org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator.setBeanFactory(AbstractAdvisorAutoProxyCreator.java:63) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeAwareMethods(AbstractAutowireCapableBeanFactory.java:1767) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1732) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:576) ... 33 more Caused by: java.lang.ClassNotFoundException: org.aspectj.lang.annotation.Pointcut at java.net.URLClassLoader.findClass(URLClassLoader.java:381) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at sun.misc.Launcher AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
… 39 more

以上异常是使用spring-aspects-5.1.1版本,出现的版本不兼容异常,解决办法:将版本改成较低版本即可。

猜你喜欢

转载自blog.csdn.net/weixin_38242503/article/details/83929270