学习spring事务管理中的报错问题(有关AOPaspect表达式的错误)

在spring的学习当中
事务管理的一段代码出现了如下错误
学习spring事务管理中的报错问题(有关AOPaspect表达式的错误)_第1张图片
“C:\Program Files\Java\jdk-11.0.2\bin\java.exe” “-javaagent:C:\Program Files\JetBrains\IntelliJ IDEA 2020.1.2\lib\idea_rt.jar=62019:C:\Program Files\JetBrains\IntelliJ IDEA 2020.1.2\bin” -Dfile.encoding=UTF-8 -classpath D:\ideaworkspace\spring\com.spring_tx\target\classes;E:\Maven\repository\mysql\mysql-connector-java\8.0.23\mysql-connector-java-8.0.23.jar;E:\Maven\repository\com\google\protobuf\protobuf-java\3.11.4\protobuf-java-3.11.4.jar;E:\Maven\repository\junit\junit\4.13.1\junit-4.13.1.jar;E:\Maven\repository\org\hamcrest\hamcrest-core\1.3\hamcrest-core-1.3.jar;E:\Maven\repository\c3p0\c3p0\0.9.1.2\c3p0-0.9.1.2.jar;E:\Maven\repository\com\alibaba\druid\1.1.10\druid-1.1.10.jar;E:\Maven\repository\org\springframework\spring-context\5.0.5.RELEASE\spring-context-5.0.5.RELEASE.jar;E:\Maven\repository\org\springframework\spring-aop\5.0.5.RELEASE\spring-aop-5.0.5.RELEASE.jar;E:\Maven\repository\org\springframework\spring-beans\5.0.5.RELEASE\spring-beans-5.0.5.RELEASE.jar;E:\Maven\repository\org\springframework\spring-core\5.0.5.RELEASE\spring-core-5.0.5.RELEASE.jar;E:\Maven\repository\org\springframework\spring-jcl\5.0.5.RELEASE\spring-jcl-5.0.5.RELEASE.jar;E:\Maven\repository\org\springframework\spring-expression\5.0.5.RELEASE\spring-expression-5.0.5.RELEASE.jar;E:\Maven\repository\org\springframework\spring-test\5.0.5.RELEASE\spring-test-5.0.5.RELEASE.jar;E:\Maven\repository\org\springframework\spring-jdbc\5.0.5.RELEASE\spring-jdbc-5.0.5.RELEASE.jar;E:\Maven\repository\org\springframework\spring-tx\5.0.5.RELEASE\spring-tx-5.0.5.RELEASE.jar com.she.controller.AccountController
2月 02, 2021 12:02:06 上午 org.springframework.context.support.AbstractApplicationContext prepareRefresh
信息: Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@56235b8e: startup date [Tue Feb 02 00:02:06 GMT+08:00 2021]; root of context hierarchy
2月 02, 2021 12:02:06 上午 org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
信息: Loading XML bean definitions from class path resource [applicationContext.xml]
2月 02, 2021 12:02:06 上午 org.springframework.context.support.AbstractApplicationContext refresh
警告: Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘jdbcTemplate’ defined in class path resource [applicationContext.xml]: BeanPostProcessor before instantiation of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘org.springframework.aop.support.DefaultBeanFactoryPointcutAdvisor#0’: Cannot create inner bean ‘(inner bean)#7ce69770’ of type [org.springframework.aop.aspectj.AspectJExpressionPointcut] while setting bean property ‘pointcut’; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘(inner bean)#7ce69770’: 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/ReflectionWorldKaTeX parse error: Expected 'EOF', got '#' at position 440: …PointcutAdvisor#̲0': Cannot crea…ReflectionWorldException
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:496)
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBeanKaTeX parse error: Expected 'EOF', got '#' at position 1226: …PointcutAdvisor#̲0': Cannot crea…ReflectionWorldException
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:327)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:131)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1605)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1357)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:578)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:501)
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBeanKaTeX parse error: Expected 'EOF', got '#' at position 1519: …e '(inner bean)#̲7ce69770': Inst…ReflectionWorldException
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1232)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1131)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:541)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:501)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:312)
… 26 more
Caused by: 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 R e f l e c t i o n W o r l d E x c e p t i o n 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 . S i m p l e I n s t a n t i a t i o n S t r a t e g y . i n s t a n t i a t e ( S i m p l e I n s t a n t i a t i o n S t r a t e g y . j a v a : 83 ) 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 s t a n t i 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 : 1224 ) . . . 30 m o r e 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 / w e a v e r / r e f l e c t / R e f l e c t i o n W o r l d ReflectionWorldException at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:83) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1224) ... 30 more Caused by: java.lang.NoClassDefFoundError: org/aspectj/weaver/reflect/ReflectionWorld ReflectionWorldExceptionatorg.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:83)atorg.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1224)...30moreCausedby:java.lang.NoClassDefFoundError:org/aspectj/weaver/reflect/ReflectionWorldReflectionWorldException
at java.base/java.lang.Class.getDeclaredConstructors0(Native Method)
at java.base/java.lang.Class.privateGetDeclaredConstructors(Class.java:3138)
at java.base/java.lang.Class.getConstructor0(Class.java:3343)
at java.base/java.lang.Class.getDeclaredConstructor(Class.java:2554)
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:78)
… 31 more
Caused by: java.lang.ClassNotFoundException: org.aspectj.weaver.reflect.ReflectionWorld R e f l e c t i o n W o r l d E x c e p t i o n a t j a v a . b a s e / j d k . i n t e r n a l . l o a d e r . B u i l t i n C l a s s L o a d e r . l o a d C l a s s ( B u i l t i n C l a s s L o a d e r . j a v a : 583 ) a t j a v a . b a s e / j d k . i n t e r n a l . l o a d e r . C l a s s L o a d e r s ReflectionWorldException at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:583) at java.base/jdk.internal.loader.ClassLoaders ReflectionWorldExceptionatjava.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:583)atjava.base/jdk.internal.loader.ClassLoadersAppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
… 36 more
Process finished with exit code 1**
**
通过排查,大概问题出现在配置事务处

在和学习视频对照后发现aspect表达式和视频内容有所不同,后面改了一下,发现了问题所在,原来是我的理解有误,我原以为包名与类名之间的两点代表该包及其以下的所有包比如之前我的表达式为"execution(* com..*.*(..))"
学习spring事务管理中的报错问题(有关AOPaspect表达式的错误)_第2张图片
按照我之前的理解,我以为这样的表达式能指向com包下的所有类
实际上,包名和类名之间的两点代表该包及其子包下的类,并不包括子包的子包所有,将以上表达式改为"execution(* com.she..*.*(..))"程序不再报错

你可能感兴趣的:(spring,java)